跨页面postback时传递JavaScript变量值
来源:岁月联盟
时间:2008-08-20
<html>
<head>
<title>HTML Start Page</title>
</head>
<body>
<form id="Form1" method="post" action="WebForm1.aspx">
<input type="text" id="yourTextBox" name="yourTextBox" value="This is the HTML page TextBox value" />
<input type="hidden" id="yourHiddenElement" name="yourHiddenElement" value="This is the HTML page hidden element value" />
<input type="submit" value="Go" />
</form>
</body>
</html>
private void Page_Load(object sender, System.EventArgs e)
{
if ( !this.IsPostBack )
{
string textBoxValue = Request["yourTextBox"];
string hiddenElementValue = Request["yourHiddenElement"];
this.Response.Write("textBoxValue: " + textBoxValue + "<br>");
this.Response.Write("hiddenElementValue: " + hiddenElementValue + "<br>");
}
}
上一篇:Javascript闭包
下一篇:js读取本地excel文档数据