首先,html代碼:
復制代碼 代碼如下:
<div style="display:none;"><iframe id="compareIframe" src=""></iframe></div>
js代碼:
復制代碼 代碼如下:
var compareContent=”你要改變的值";
if (compareContent != "") {
document.getElementById("compareIframe").src = "ajax/changeSession.aspx?compareInfo=" +compareContent;
}
ajax:
changeSession.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
Session["compare"] = Request.QueryString["compareInfo"];
}
//end
//<a href=”http://www.cnblogs.com/wuchao/”></a>