鍍金池/ 問(wèn)答/HTML/ input 標(biāo)簽onblur時(shí)間不生效

input 標(biāo)簽onblur時(shí)間不生效

<form action="login" method="post" onSubmit="return check()">

用戶名: <input class="easyui-textbox" id="rymc" name="rymc" onblur="return checkRymc(this.value.toLowerCase());"> <p id="err1"></p>
密碼: <input id="mm" name="mm" onblur="return checkMm(this.value);"> <p id="err2"></p>

</form>

js
<script type="text/javascript">

        
        function check(){
            var rymc = $('#rymc').attr('value');
            var mm = $('#mm').attr('value');
            var requestText = new Object();
            $.ajax({
                type:"post",
                contentType:"application/String",
                dataType:"json",
                async:false,
                url:"err?rymc="+rymc,
                success:function(data){
                    requestText = data;
                }
            });
            if(requestText=="userErr"){
                document.getElementById('#err1').innerHTML="<font color='red'>用戶名不存在</font>";
                return false;
            }else if(requestText=="mmErr"){
                document.getElementById('#err2').innerHTML="<font color='red'>密碼錯(cuò)誤</font>"
                return false;
            }else if(requestText=="ok"){
                return true;
            }else{
                alert('sth is wrong!')
                return false;
            }
        };
            function checkRymc(param){
                alert('checkRymc');
                if( param.length<3 || param.length>18 ) {  
                    document.getElementById("#err1").innerHTML = "<font color='red'> 請(qǐng)輸入正確的用戶名,用戶名長(zhǎng)度為3-18位!</font>";  
                    form.rymc.focus() ; 
                    return false;  
              }  
              if (isWhiteWpace(param)){  
                    document.getElementById("#err1").innerHTML = "<font color='red'>請(qǐng)輸入正確的用戶名,用戶名中不能包含空格!</font>";  
                    form.rymc.focus()  ;
                    return false;  
                }
            };
            function checkMm(param){
                if(param == ''){
                    document.getElementById('#err2').innerHTML = "<font color='red'>請(qǐng)輸入密碼!</font>"
                    return false;
                }  
            }
      
    </script>
回答
編輯回答
毀了心

能具體點(diǎn)么?

2017年4月20日 06:52