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