<html>
<body>
<script>
function ElementIsemptyCheck(strname,strmsg)
{
if ((document.all(strname).value)=="")
{
alert(strmsg);
document.all(strname).focus();
return false;
}}</script>
<input type=text id=po>
<input type=button value="height" onclick="ElementIsemptyCheck('po','input')">
</body>
</html>
<body>
<script>
function ElementIsemptyCheck(strname,strmsg)
{
if ((document.all(strname).value)=="")
{
alert(strmsg);
document.all(strname).focus();
return false;
}}</script>
<input type=text id=po>
<input type=button value="height" onclick="ElementIsemptyCheck('po','input')">
</body>
</html>
我是在asp.net里用的
LnkSubmit.Attributes["onClick"]="return CommonUserReg_2_Valid();";
我将return去掉后还是继续执行to gzh_seagull(不可) ( )这样自然可行..
但是下面还有啊..不能return走了
ElementIsemptyCheck("TxtUsername","请输入用户名");
ElementIsemptyCheck("TxtPassword","请输入密码");
....
if(ElementIsemptyCheck("TxtUsername","请输入用户名")==false){
return false;}
else if (ElementIsemptyCheck("TxtUsername","请输入密码")==false){return false;}
....