<html> <head> <title>用户名验证</title> <style> a{ display:none; } </style> <script type="text/javascript"> function one(){ var b=document.getElementById("b").value; var a=document.getElementById("a"); if(b==""){ a.innerText="用户名不能为空"; a.style.display="block"; }else{ a.style.display="none"; ] } </script> </head> <body> <table> <tr> <td> <label>用户名</label><input type="text" onblur="one()" id="b" /> </td> </tr> <tr> <td id="a"></td> </tr> <tr> <td> <label>密 码</label><input type="password" /> </td> </tr> </table> </body></html>
添加回答
举报
0/150
提交
取消