Home >Backend Development >PHP Tutorial >关于POST传值,加了一段js代码传不过去,去掉就可以

关于POST传值,加了一段js代码传不过去,去掉就可以

WBOY
WBOYOriginal
2016-06-23 14:04:24728browse

加了验证登陆的js,然后点submit提交,uname的值和pwd的值,都为空,去掉js代码,就可以获得uname值和pwd值,为什么?


<script> <br /> function formCheck(){ <br /> if(myform.uname.value=""){ <br /> alert("用户名不能为空!!"); <br /> myform.uname.focus(); <br /> return false; <br /> } <br /> if(myform.pwd.value=""){ <br /> alert("密码不能为空!!!"); <br /> myform.pwd.focus(); <br /> return false; <br /> } <br /> <br /> } <br /> <br /> </script>
 
   


    用户名:

           密码:

      
   
   


回复讨论(解决方案)

if(myform.uname.value ==""){
alert("用户名不能为空!!");
myform.uname.focus();
return false;
}
if(myform.pwd.value ==""){
...

等于是两个等号

。。。。这错的太低级了,谢谢楼上两位

我也来这里学习下啊 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn