日期:2014-05-17  浏览次数:20743 次

弱问一下以下代码有什么错误
<%@   Page   language= "C# "   %>
<html>
<body>
<input   id= "btn "   value= "Press   Me "   runat= "server "   type= "BUTTON "   onserverclick= "Do ">
<script   language=C#   runat= "server ">
void   Do(Object   sender,   EventArgs   e)
{
btn.Value= "You   have   pressed   me ";
}
</script>
</body>
</html>
保存为a.aspx
平台   .Net   1.1
运行后点那个按键就出“缺少对象”的错误。
哪位给看看?谢谢啦

------解决方案--------------------
<%@ Page language= "C# " %>
<html>
<body>
<form id= "Form1 " method= "post " runat= "server ">
<input id= "btn " value= "Press Me " runat= "server " type= "BUTTON " onserverclick= "Do ">
<script language=C# runat= "server ">
void Do(Object sender, EventArgs e)
{
btn.Value= "You have pressed me ";
}
</script>
</form>
</body>
</html>

------解决方案--------------------
postback机制要依靠form来提交,所以不能缺少form