当前位置:编程学习 > JAVA >>

非活性按钮

<html>
 <head>
  <title>Login</title>
  <script type="text/javascript" src="show.js">
  </script>
 </head>
 <body>
  <table>
   <tr>
    <td>
     用户名:
    </td>
    <td>
     <input type="text" name="userId" id="userId" style="width: 150px" maxlength="9"/>
    </td>
   </tr>
   <tr>
    <td>
     密  码:
    </td>
    <td>
     <input type="password" name="password" style="width: 150px;" size="20" id="password" onkeyup="javascript:show()"/>
    </td>
   </tr>
   <tr>
    <td colspan="2" align="center">
     <input type="button" name="submit" style="width: 50px; height: 25" value="登陆" id="submit" disabled />
    </td>
   </tr>
  </table>
 </body>
</html>

show.js
   function show(){
    var userId = document.getElementById("userId").value;
    var password = document.getElementById("password").value;
    if(userId =="" || password ==""|| userId ==null || password ==null){
     document.getElementById("submit").disabled=true;
    }else{    www.zzzyk.com
     document.getElementById("submit").disabled=false;
    }
   }

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,