怎么样能让文本框为空是才跳出confirm,我哪里写错了吗
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> 鼠标经过事件 </title> <script type="text/javascript"> var passw=document.getElementById("pwd"); function message(){ if(passw.value==""){ confirm("请输入密码后,再单击确定!"); } } </script> </head> <body> <form> 密码:<input id="pwd" name="password" type="password" > <input name="确定" type="button" value="确定" onmouseover="message()"/> </form> </body> </html>
如题