一个.ASP.NET代码,帮看一下毛病. (50分)

  • 主题发起人 主题发起人 fancylxs
  • 开始时间 开始时间
F

fancylxs

Unregistered / Unconfirmed
GUEST, unregistred user!
这是一个ASP.NET代码,有一个毛病,我已经对过书了,没什么错误,可还是不能执行.
<script language="vb" runat="server">
sub my_click(sender as boject,e as eventargs)
end sub
</script>
<html>
<body>
<form runat="server">
姓名:<asp:textbox id="myname" runat="server"/>
<asp:regularexpressionvalidator id="checkname" runat="server" controltovalidate="myname" validationexpression=".{2,}" text="必填文本框" errormessage="姓名文本框输入错误,最少填入两个字符"/>
<br>
e.mail:<asp:textbox id="mymail" runat="server"/>
<asp:regularexpressionvalidator id="checkmail" runat=server" controltovalidate="mymail" validationexpression=".{1,}@.{3,}/..{1,}" text="必填文本框" errormessage="e-mail文本框输入错误,请填写正确格式的电子邮件信箱"/>
<br>
住址:<asp:textbox id="myaddress" runat="server"/>
<asp:regularexpressionvalidator id="checkaddress" runat="server" controlvalidate="myaddress" validationexpression=".{1,}(县|市).{1,}(市|镇|乡|区).{1,}(路|街|道).{1,}号.{0,}" text="必填文本框" errormessage="住址文框输入错误,请详细填你的居住地址"/>
<br>
<asp:button id="mybutton" runat="server" onclick="my_click" text="确定"/>
<asp:validationsummary id="check" runat="server" headertext="请按下列说明输入文本框数据" displaymode="bulletlist"/>
</form>
</body>
</html>
 
//上面代码有三处输入错误
1. sub my_click(sender as boject,e as eventargs)中的boject改为object
2. <asp:regularexpressionvalidator id="checkmail" runat=server" controltovalidate="mymail" 中
的 runat=server"改为runat="server"
3.<asp:regularexpressionvalidator id="checkaddress" runat="server" controlvalidate="myaddress"
中controlvalidate改为controltovalidate
//修改后
<script language="vb" runat="server">
sub my_click(sender as object,e as eventargs)
end sub
</script>
<html>
<body>
<form runat="server">
姓名:<asp:textbox id="myname" runat="server"/>
<asp:regularexpressionvalidator id="checkname" runat="server" controltovalidate="myname"
validationexpression=".{2,}" text="必填文本框" errormessage="姓名文本框输入错误,最少填入两个字符"/>
<br>
e.mail:<asp:textbox id="mymail" runat="server"/>
<asp:regularexpressionvalidator id="checkmail" runat="server" controltovalidate="mymail"
validationexpression=".{1,}@.{3,}/..{1,}" text="必填文本框"
errormessage="e-mail文本框输入错误,请填写正确格式的电子邮件信箱"/>
<br>
住址:<asp:textbox id="myaddress" runat="server"/>
<asp:regularexpressionvalidator id="checkaddress" runat="server" controltovalidate="myaddress"
validationexpression=".{1,}(县|市).{1,}(市|镇|乡|区).{1,}(路|街|道).{1,}号.{0,}" text="必填文本框"
errormessage="住址文框输入错误,请详细填你的居住地址"/>
<br>
<asp:button id="mybutton" runat="server" onclick="my_click" text="确定"/>
<asp:validationsummary id="check" runat="server" headertext="请按下列说明输入文本框数据"
displaymode="bulletlist"/>
</form>
</body>
</html>
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
759
import
I
D
回复
0
查看
828
DelphiTeacher的专栏
D
后退
顶部