Button 控件的 OnClientClick 和 OnClick 事件执行顺序问题
<head runat= "server ">
<title> 无标题页 </title>
<script language= "javascript ">
function check()
{
var email = document.getElementById( 'TextBox1 ');
var pwd = document.getElementById( 'TextBox2 ');
if (email.value== " " || pwd.value== " ")
{
alert( "请填写完整内容 ");
return false;
}
else
{
var mailStr = /((\w)+)@((\w)+).[cc|com|net|org|tv|cn]/ig;
if (!mailStr.exec(email.value))
{
alert( 'Email地址书写不正确!\n请您重新输入! ');
email.value = ' ';
email.focus();
return false;
}
}
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:TextBox ID= "TextBox1 " runat= "server "> </asp:TextBox>
<asp:TextBox ID= "TextBox2 " runat= "server "> </asp:TextBox>
<asp:Button ID= "Button1 " runat= "server " Text= "Button " OnClientClick= "check() " OnClick= "Button1_Click1 " /> </div>
</form>
</b