关于变量生命周期的问题(加急)
WebForm1.aspx:
<HTML>
<HEAD>
<title>WebForm1</title>
<script src="JScript1.js"></script>
</HEAD>
<body>
<form runat="server">
<INPUT value="Value++" type="button" onclick="showMsg()">
<INPUT value="showWindows" type="button" onclick="window.open('WebForm2.aspx')">
</form>
</body>
</HTML>
WebForm2.aspx:
<HTML>
<HEAD>
<title>WebForm2</title>
<script src="JScript1.js"></script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<INPUT type="button" value="showCount" onclick="alert(intCount)">
</form>
</body>
</HTML>
JScript1.js:
var intCount=0;
function showMsg()
{
alert(++intCount);
}
以上为测试代码.
我想实现的功能为:
在WebForm1中单击几次value++按钮,使intCount改变.
然后打开WebForm2,单击showCount按钮,显示intCount的值.
我想在WebForm2中得到被WebForm1改变以后的值,但实际上单击showCount按钮后intCount始终为0.
请问怎么才能使这俩个页面共用一个值?(因为WebForm2在实际项目中不一定是WebForm1打开的,所以不能使用window.parent)
请高手帮忙