ASP,如何用后台获取前台JS的返回值
<script language="javascript">
function changediv() {
var a = "";
var t2 = document.getElementById("t2").style.display;
var t3 = document.getElementById("t3").style.display;
var t4 = document.getElementById("t4").style.display;
var t5 = document.getElementById("t5").style.display;
if (t2 == "" && t3 == "none" && t4 == "none" && t5 == "none") {
a = 1;
}
if (t2 == "" && t3 == "" && t4 == "none" && t5 == "none") {
a = 2;
}
if (t2 == "" && t3 == "" && t4 == "" && t5 == "none") {
a = 3;
}
if (t2 == "" && t3 == "" && t4 == "" && t5 == "") {
a = 4;
}
return a;
}
</script>
我前台写的这个JS,想在后台获取返回值a,怎么获取???? --------------------编程问答--------------------
添加个隐藏控件 然后把a值赋给隐藏控件 然后获取隐藏控件的值 --------------------编程问答--------------------
求来个详细的方法说明!! --------------------编程问答--------------------
<script>
function test() {
document.getElementById("HiddenField1").value = "滚";
}
</script>
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="test()" OnClick="Button1_Click" />
--后台
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(HiddenField1.Value);
}
补充:.NET技术 , ASP.NET