日期:2014-05-20  浏览次数:20445 次

后台怎么得到Text的文本值
<%@   Page   Language= "C# "   AutoEventWireup= "true "     CodeFile= "Default.aspx.cs "   Inherits= "_Default "   %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<script>
  function   test()
  {
var   reg=   /\S/;
var   v=t.value;
if(v.match(reg))   alert(t.value);
else   alert( "为空 ");
  }
</script>
</head>
<body>
<button   onclick= "test() "   id= "BUTTON1 "     runat= "server "   >
        验证 </button>
<input   id= "t "   type= "text "/>
</body>
</html>

求在后台得到text的值,速度啊大哥们,着急的很!~

------解决方案--------------------
把 <input id= "t " type= "text "/> 放到 <form> </form> 中
<form>
<input id= "t " name= "t " type= "text "/>
</form>
然后在服务器端通过 Request.Form[ "t "]来获取 text的内容