为何点击提交按钮却是刷新页面?在线等
我刚学ASP 做一个注册页面 但是点击提交后却刷新该页面 我和教材程序比较后未发现不对 可是教材能调用check()函数判断“用户名”是否填写等等情况
以下是代码:
<%@LANGUAGE= "VBSCRIPT " CODEPAGE= "936 "%>
<!--#include file= "conn.asp "-->
<html>
<head>
<title> MyBlog首页 </title>
</head>
<script language= "JavaScript ">
function check(){
if(document.form1.username.value= " ") {
document.form1.username.focus();
alert( "对不起,请填写用户名! ");
return false;
}
if(checkspace(document.form1.pass1.value) || document.form1.pass1.value.length < 6 || document.form1.pass1.value.length > 12) {
document.form1.pass1.focus();
alert( "密码长度不能为空,在6位到20位之间,请重新输入! ");
return false;
}
if(document.form1.pass1.value != document.userinfo.pass2.value) {
document.form1.pass1.focus();
document.form1.pass1.value = ' ';
document.form1.pass2.value = ' ';
alert( "两次输入的密码不同,请重新输入! ");
return false;
}
if(document.form1.email.value.length!=0)
{
if (document.form1.email.value.charAt(0)== ". " ||
document.form1.email.value.charAt(0)== "@ "||
document.form1.email.value.indexOf( '@ ', 0) == -1 ||
document.form1.email.value.indexOf( '. ', 0) == -1 ||
document.form1.email.value.lastIndexOf( "@ ")==document.userinfo.useremail.value.length-1 ||
document.form1.email.value.lastIndexOf( ". ")==document.userinfo.useremail.value.length-1)
{
alert( "Email地址格式不正确! ");
document.form1.email.focus();
return false;
}
}
else
{
alert( "Email不能为空! ");
document.form1.email.focus();
return false;
}
if(document.form1.passquestion.value= " ") {
document.form1.passquestion.focus();
alert( "对不起,请填写密码提问! ");
return false;
}
if(document.form1.passanswer.value= " ") {
document.form1.passanswer.focus();
alert( "对不起,请填写密码提问的答案! ");
return false;
}
}
</script&g