请问怎样把这两个javascript的值传给C#的string? 你先把javascript裡面var的值傳到一個text or button,在server端讀取text or button的值就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 利用网页传值,在后台Request得到 定义两个input type=hidden, 分别为a,b在函数中document.all.a.value = a;document.all.b.value = b;在后台Request.Params["a"]Request.Params["b"]来取值. 我的code就是如下,请问怎样实现我<script language="C#" runat="server"> public void Page_Load(Object sender, EventArgs e) {Label1.Text=??;Label1.Text=??;}</script><html><head><script language="javascript" type="text/javascript"><!--var crossobj;function initializedrag(e){ crossobj=document.all? document.getElementById("showimage") : document.all;}window.onload=initializedrag;function showbox(bShow){ crossobj.style.visibility= bShow? "visible" : "hidden";}var win=null;function CheckSubmit(f) {var a = f.strWriter.valuevar b=f.strPassword.valueif (a=="") { alert("内容不能为空!") return }if (b=="") { alert("内容不能为空!") return } } </script><FORM method="POST" id=FormResponse name=FormResponse><div id="showimage" style="position:absolute;width:159;left:282;top:129;visibility:hidden; height:107"><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="150" id="AutoNumber1" height="57"> <tr> <td width="29%" height="19" valign="bottom">用户名:</td> <td width="36%" height="19"> <p align="center"><input type='text' name='strWriter' value='' size=14 class=input></td> </tr> <tr> <td width="29%" height="19" valign="bottom">密 码:</td> <td width="36%" height="19"> <p align="center"> <input type='password' name='strPassword' value='' size=14 class=input></td> </tr> <tr> <td width="29%" height="19"> </td> <td width="36%" height="19" align="center"> <p align="center"> <input type="button" value="确认" onclick="CheckSubmit(FormResponse)" id=submit2 name=submit2></td> </tr></table></div><a href="#" onmouseover="showbox(true);return false;">popout</a><form runat="server"><asp:Label runat=server id=Label1 Text="" /><asp:Label runat=server id=Label2 Text="" /></form></body></html>就是把用户名和密码的值传给Label1和Label2,请问怎么办? 用Hidden控件塞,客户端、服务器端都可以取值。 System.ArgumentException: 回發或回調參數無效 奇怪的问题 谁有纯粹XML的留言本? 没有numeric,用啥类型代替? 怎样将数据库合到一起 asp.net如何得到受影响的行数 机器不能运行<% %>之间的内容是怎么回事? 请问ASP中ADO组件要注册吗 俺明天就签约了,请大家进来谈谈经验。:D 大哥们,急啊! 怎么用树形结构控件....介绍篇文章也好!谢了 怎样实现点击提交按钮后自动跳到指定的aspx页面?我写了一个但不行(附源码)? 数据字段自动生成问题?
document.all.a.value = a;
document.all.b.value = b;在后台
Request.Params["a"]
Request.Params["b"]
来取值.
Label1.Text=??;
}
</script>
<html><head>
<script language="javascript" type="text/javascript">
<!--
var crossobj;
function initializedrag(e)
{
crossobj=document.all? document.getElementById("showimage") : document.all;
}
window.onload=initializedrag;function showbox(bShow)
{
crossobj.style.visibility= bShow? "visible" : "hidden";
}
var win=null;function CheckSubmit(f) {
var a = f.strWriter.value
var b=f.strPassword.value
if (a=="")
{
alert("内容不能为空!")
return
}
if (b=="")
{
alert("内容不能为空!")
return
} }
</script><FORM method="POST" id=FormResponse name=FormResponse>
<div id="showimage" style="position:absolute;width:159;left:282;top:129;visibility:hidden; height:107"><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="150" id="AutoNumber1" height="57">
<tr>
<td width="29%" height="19" valign="bottom">用户名:</td>
<td width="36%" height="19">
<p align="center"><input type='text' name='strWriter' value='' size=14 class=input></td>
</tr>
<tr>
<td width="29%" height="19" valign="bottom">密 码:</td>
<td width="36%" height="19">
<p align="center"> <input type='password' name='strPassword' value='' size=14 class=input></td>
</tr>
<tr>
<td width="29%" height="19"> </td>
<td width="36%" height="19" align="center">
<p align="center"> <input type="button" value="确认" onclick="CheckSubmit(FormResponse)" id=submit2 name=submit2></td>
</tr>
</table></div><a href="#" onmouseover="showbox(true);return false;">popout</a>
<form runat="server"><asp:Label runat=server id=Label1 Text="" />
<asp:Label runat=server id=Label2 Text="" /></form>
</body>
</html>
就是把用户名和密码的值传给Label1和Label2,请问怎么办?