前台js改变Session的值(用ajax实现)
时间:2021-08-13 07:36:10|栏目:JavaScript代码|点击: 次
首先,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>
复制代码 代码如下:
<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>
上一篇:Javascript自定义函数判断网站访问类型是PC还是移动终端
栏 目:JavaScript代码
本文地址:http://www.codeinn.net/misctech/166500.html