日期:2014-05-17  浏览次数:20948 次

大家给看看这个js,怎么总是出错呢
<script   language= "javascript ">
function   CheckLoginForm()
{  
if   (document.nform.xm.value     ==   " ")
{
alert( "请填写您的用户名! ");
document.nform.xm.focus();
return   false;
}
if   (document.nform.mm.value     ==   " ")  
{
alert( "请填写您的密码! ");
document.nform.mm.focus();
return   false;  
}
                document.nform.submit();
return   true;
}
</script>


<form     name= "nform "   method= "post "   action= "login.asp "   onsubmit= "return   CheckLoginForm() ">

<input   name= "xm "   type= "text "   size= "12 "   />
<input   name= "mm "   type= "password "   size= "12 "   />
</form>
谢谢拉!!!!!本人在线等!!!!!!

------解决方案--------------------
<script language= "javascript ">
function CheckLoginForm()
{
if (document.nform.xm.value == " ")
{
alert( "请填写您的用户名! ");
document.nform.xm.focus();
return false;
}
if (document.nform.mm.value == " ")
{
alert( "请填写您的密码! ");
document.nform.mm.focus();
return false;
}
document.nform.submit();
return true;
}
</script>


<form name= "nform " method= "post " action= "login.asp ">

<input name= "xm " type= "text " size= "12 " />
<input name= "mm " type= "password " size= "12 " />
<input type=button onclick= "return CheckLoginForm() ">
</form>
------解决方案--------------------
<img src= "images/denglu.jpg " width= "72 " height= "22 " onclick= "CheckLoginForm(); ">
------解决方案--------------------
没有提交啊
在 </form> 前边加上
<input type= "submit " value= "提交 ">