我对javascript不熟,不会写,请求帮助
<script language="JavaScript">
//-->
function VerifyInput()
{
username = document.myform.username.value;
if (username == "")
{
alert("请填写您的用户名");
document.myform.username.focus();
return false;
}
password1 = document.myform.password1.value;
if (password1 == "")
{
alert("请填写您的密码");
document.myform.password1.focus();
return false;
}
password2 = document.myform.password2.value;
if (password2 == "")
{
alert("请填写您的确认密码");
document.myform.password2.focus();
return false;
}
if (password2 == password1)
{
}
else
{
alert("您两次输入的密码不相同");
document.myform.password2.focus();
return false;
}
truename = document.myform.truename.value;
if (truename == "")
{
alert("请填写您的真实姓名");
document.myform.truename.focus();
return false;
}
infonumber = document.myform.infonumber.value;
if (infonumber == "")
{
alert("请填写您的身份证号");
document.myform.infonumber.focus();
return false;
}
school = document.myform.school.value;
if (school == "")
{
alert("请填写您的毕业学院");
document.myform.school.focus();
return false;
}
email = document.myform.email.value;
if (email == "")
{
alert("请填写您的电子邮件(Email)");
document.myform.email.focus();
return false;
}
if(document.myform.email.value.length!=0)
{
if (document.myform.email.value.charAt(0)=="." || document.myform.email.value.charAt(0)=="@"|| document.myform.email.value.indexOf('@', 0) == -1 || document.myform.email.value.indexOf('.', 0) == -1||document.myform.email.value.lastIndexOf("@") ==document.myform.email.value.length-1 || document.myform.email.value.lastIndexOf(".")==document.myform.email.value.length-1)
{
alert("您输入的电子邮件(Email)格式不对");
document.myform.email.focus();
return false;
}
}
else
{
alert("Email的不能为空!");
document.myform.email.focus();
return false;
}
tel = document.myform.tel.value;
if (tel == "")
{
alert("请填写您的联系电话");
document.myform.tel.focus();
return false;
}
address = document.myform.address.value;
if (address == "")
{
alert("请填写您的通信地址");
document.myform.address.focus();
return false;
}
postcode = document.myform.postcode.value;
if (postcode == "")
{
alert("请填写您的通信地址");
document.myform.postcode.focus();
return false;
}
}
//-->
</script>