我有个button
protected void button1(object sender,eventargs e)
{
Response.Write("<script language='javascript'> var tempA=window.prompt('请输入你的购买数量','')</script>");
}
点击下button,将会弹出一个对话框;并且你输入的数据会传递给tempA;
我想问问;如何在后台里面获得tempA的值;
假设我后台有个全局变量int i=0; 如何让i获得tempA;
protected void button1(object sender,eventargs e)
{
Response.Write("<script language='javascript'> var tempA=window.prompt('请输入你的购买数量','')</script>");
}
点击下button,将会弹出一个对话框;并且你输入的数据会传递给tempA;
我想问问;如何在后台里面获得tempA的值;
假设我后台有个全局变量int i=0; 如何让i获得tempA;
比如用到ajax哪些函数或者关键字。
期待3楼进一步解答。
function GetValue() {
document.getElementById("<%=Hidden1.ClientID %>").value = window.prompt('请输入你的购买数量', '');
}
</script>.html
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="GetValue()" />
<input type=hidden id="Hidden1" runat=server />.cs
Response.Write("刚才输入的值:"+this.Hidden1.Value.ToString());