div下js验证问题
<scripttype="text/javascript">functionlogincheck(){if(loginform.user.value=""){alert(...
<script type="text/javascript">
function logincheck(){
if (loginform.user.value=""){
alert ("请输入用户名");
loginform.user.focus();
return false;
}
if (loginform.pw.value=""){
alert ("请输入用户名");
loginform.pw.focus();
return false;
}
}
</script>
</head>
<body>
<div id="login">
<div id="top">
<div id="top_left"><img src="images/login_03.gif" /></div>
<div id="top_center"></div>
</div>
<form action="login.php" method="post" name="loginform" onsubmit="return logincheck(this);">
<div id="center">
<div id="center_left"></div>
<div id="center_middle">
<div id="user">用 户
<input type="text" name="user" />
</div>
<div id="password">密 码
<input type="password" name="pw" />
</div>
<div id="btn">
<input type="submit" value="登录" name="submit" />
<input type="reset" value="取消" name="reset"/>
</div>
</div>
<div id="center_right"></div>
</div>
</form>
<div id="down">
<div id="down_left">
<div id="inf">
<span class="inf_text">版本信息</span>
<span class="copyright">留言管理系统 2012 v1.0</span>
</div>
</div>
<div id="down_center"></div>
</div>
</div>
</body>
这段代码有什么问题吗,js验证没有执行,网上找了很多帖子都没有解决 ,求高手解答 展开
function logincheck(){
if (loginform.user.value=""){
alert ("请输入用户名");
loginform.user.focus();
return false;
}
if (loginform.pw.value=""){
alert ("请输入用户名");
loginform.pw.focus();
return false;
}
}
</script>
</head>
<body>
<div id="login">
<div id="top">
<div id="top_left"><img src="images/login_03.gif" /></div>
<div id="top_center"></div>
</div>
<form action="login.php" method="post" name="loginform" onsubmit="return logincheck(this);">
<div id="center">
<div id="center_left"></div>
<div id="center_middle">
<div id="user">用 户
<input type="text" name="user" />
</div>
<div id="password">密 码
<input type="password" name="pw" />
</div>
<div id="btn">
<input type="submit" value="登录" name="submit" />
<input type="reset" value="取消" name="reset"/>
</div>
</div>
<div id="center_right"></div>
</div>
</form>
<div id="down">
<div id="down_left">
<div id="inf">
<span class="inf_text">版本信息</span>
<span class="copyright">留言管理系统 2012 v1.0</span>
</div>
</div>
<div id="down_center"></div>
</div>
</div>
</body>
这段代码有什么问题吗,js验证没有执行,网上找了很多帖子都没有解决 ,求高手解答 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询