--
function check()
{
if(form1.login.value=="")
{
alert("请填写登录名信息。");
return false;
}
if(form1.pass.value=="")
{
alert("请填写登录名密码信息。");
return false;
}
if(form1.login.value=="admin" && form1.pass.value=="admin")
{
alert("感谢您的登陆,单击确定进入管理界面");
form1.submit();
}
else
{
alert("登录名或密码输入错误。");
return false;
}
return true;
form1.submit();
{
}
为什么这段代码就无法运行出来了呢,不知道错哪儿了,需要大师的指导!!!!!谢谢!!!!
function check()
{
if(form1.login.value=="")
{
alert("请填写登录名信息。");
return false;
}
if(form1.pass.value=="")
{
alert("请填写登录名密码信息。");
return false;
}
if(form1.login.value=="admin" && form1.pass.value=="admin")
{
alert("感谢您的登陆,单击确定进入管理界面");
form1.submit();
}
else
{
alert("登录名或密码输入错误。");
return false;
}
return true;
form1.submit();
{
}
为什么这段代码就无法运行出来了呢,不知道错哪儿了,需要大师的指导!!!!!谢谢!!!!
请贴出对应的HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>表单登陆</title>
</head>
<body>
<script language="javascript">
<!--
function check()
{
if(form1.login.value=="")
{
alert("请填写登录名信息。");
return false;
}
if(form1.pass.value=="")
{
alert("请填写登录名密码信息。");
return false;
}
if(form1.login.value=="admin" && form1.pass.value=="admin")
{
alert("感谢您的登陆,单击确定进入管理界面");
form1.submit();
}
else
{
alert("登录名或密码输入错误。");
return false;
}
return true;
form1.submit();
{
}//-->
</script>
<form id="form1" name="form1" method="post" action="javaasp.asp">
<table width="350" border="0" cellpadding="1" cellspacing="1" bgcolor="#E3E9F1">
<tr>
<th width="119" scope="row"><div align="right" class="STYLE4">登录名:
</div></th>
<td width="224"><label>
<input type="text" name="login" />
</label></td>
</tr>
<th scope="row"><div align="right" class="STYLE4">密码:</div></th>
<td><label>
<input type="password" name="pass" />
</label></td>
</tr>
<tr>
<th colspan="2" scope="row"><label>
<input type="submit" name="Submit" value="提交" onclick="check()" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label></th>
</tr>
</table>
</form>
</body>
</html>