急,急,急,为何asp.net弹出客户错误消息窗口确定后还刷新页面????
如判断用户是否输字符时,如果未输入就js弹出警告窗口,为什么点确定后还要刷新页页??????????怎么才能搞定不刷新呀,拜托了....!!!!!!!!!
------解决方案-------------------- <html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
<script language = "javascript " >
function ClearText()
{
if(document.form1.txtName.value == " ")
{
alert( "请输入名称 ");
document.form1.txtName.focus();
return false;
}
}
</script>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:TextBox ID= "txtName " runat= "server "> </asp:TextBox>
<asp:Button ID= "btnClick " runat= "server " Text= "Button " OnClientClick = "return ClearText(); " />
</div>
</form>
</body>
</html>