像我这个代码,怎么修改呢?
我想实现的是,点击确定后,会去判断密码框是否有密码,若没有密码,则不行……
2015-01-12
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> 鼠标经过事件 </title> <script type="text/javascript"> function message(){ var aaa=document.getElementById("password").value; if(aaa==""){ confirm("请输入密码后,再单击确定!") } } </script> </head> <body> <form> 密码:<input name="password" type="password" id="password"> <input name="确定" type="button" value="确定" onmouseover="message()"/> </form> </body> </html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 鼠标经过事件 </title>
<script type="text/javascript">
function message(){
var mess=confirm("请输入密码后,再单击确定!");
if(mess==true)
{
var me=getElementById("pass");
if(me=="")
{
alert("请输入密码!")
}
}
}
</script>
</head>
<body>
<form>
密码:<input id="pass" name="password" type="password" >
<input name="确定" type="button" value="确定" onmouseover="message()"/>
</form>
</body>
</html>
举报