永泰城主题乐园在那:ASP.NET的问题,急,高分求救
来源:百度文库 编辑:高校问答 时间:2024/04/26 02:14:25
<script language="javascript" type="text/JavaScript">
function check()
{
if(document.form2.username.value=="")
{alert("please write down the user ID");
document.form2.username.focus();
return false;
}
if(document.form2.pwd.value=="")
{alert("please write down the password");
document.form2.pwd.focus();
return false;
}
if(document.form2.spwd.value=="")
{alert("please sure the password");
document.form2.spwd.focus();
return false;
}
if(document.form1.spwd.value=document.form2.pwd.value)
{alert("2次输入的密码不同");
return false;
}
if(document.form2.email.value=="")
{alert("please sure the password");
document.form2.spwd.focus();
return false;
}
}
document.form2.ctype.value="add";
document.form2.submit();
实在不行的话,你们谁留下QQ,再细谈吧
<script language="javascript" type="text/JavaScript">
function check()
{
if(document.form2.username.value=="")
{alert("please write down the user ID");
document.form2.username.focus();
return false;
}
if(document.form2.pwd.value=="")
{alert("please write down the password");
document.form2.pwd.focus();
return false;
}
if(document.form2.spwd.value=="")
{alert("please sure the password");
document.form2.spwd.focus();
return false;
}
if(document.form2.spwd.value=document.form2.pwd.value) //应该是form2吧?
{alert("2次输入的密码不同");
return false;
}
if(document.form2.email.value=="")
{alert("please sure the password");
document.form2.spwd.focus();
return false;
}
//这个应该写进方法内部
document.form2.ctype.value="add";
document.form2.submit();
}
</script>
//另外,检查一下有无拼写错误
这个代码应该不能提交吧,代码有错
if(document.form1.spwd.value=document.form2.pwd.value)
应为!=
document.form2.ctype.value="add";
document.form2.submit();
应该放在函数体内
如果你的代码调用是在subit按钮上则最后句改成return true;
放在普通按钮或链接上则不用改
<script language="javascript" type="text/JavaScript">
function check()
{
if(document.form2.username.value=="")
{alert("please write down the user ID");
document.form2.username.focus();
return false;
}
if(document.form2.pwd.value=="")
{alert("please write down the password");
document.form2.pwd.focus();
return false;
}
if(document.form2.spwd.value=="")
{alert("please sure the password");
document.form2.spwd.focus();
return false;
}
if(document.form2.spwd.value!=document.form2.pwd.value)
{alert("2次输入的密码不同");
return false;
}
if(document.form2.email.value=="")
{alert("please sure the password");
document.form2.spwd.focus();
return false;
}
document.form2.ctype.value="add";
document.form2.submit();
}