Topic: 麻烦帮看看,javascript死活不弹出验证对话框,tks! |
Print this page |
1.麻烦帮看看,javascript死活不弹出验证对话框,tks! | Copy to clipboard |
Posted by: k_k_grass Posted on: 2003-06-08 00:41 以下是代码: <html> <head> <title> login </title> </head> <body bgcolor="#ffffff"> <form name="form1"> <br><br> 用户名:<input type="text" name="userName"><br> 密码:<input type="password" name="password"><br> <input type="submit" name="Submit" value="Submit" onClick='checkInput()'> <script language="javascript"> <!-- function checkInput(){ if(form1.userName.Value==" ") { alert("请输入登陆信息!"); window.form1.userName.focus(); return; } else if(form1.password.Value==" ") { alert("请输入口令!"); window.form1.password.focus(); return; } form1.submit(); } --> </script> <input type="reset" value="Reset"> </form> </body> </html> |
2.Re:麻烦帮看看,javascript死活不弹出验证对话框,tks! [Re: k_k_grass] | Copy to clipboard |
Posted by: ww77721 Posted on: 2003-06-08 08:31 Value 换成小写的 value if(form1.userName.value == "") |
3.Re:麻烦帮看看,javascript死活不弹出验证对话框,tks! [Re: k_k_grass] | Copy to clipboard |
Posted by: k_k_grass Posted on: 2003-06-08 10:22 可还是不成 |
4.Re:麻烦帮看看,javascript死活不弹出验证对话框,tks! [Re: k_k_grass] | Copy to clipboard |
Posted by: why Posted on: 2003-06-08 11:19 k_k_grass wrote: 怎樣不成? if(form1.userName.value==" ") 要在userName欄上鍵入一個空格才行 return; 應該是 return false; 否則仍會submit囉 onClick='checkInput()' 是 onSubmit嗎? |
5.Re:麻烦帮看看,javascript死活不弹出验证对话框,tks! [Re: k_k_grass] | Copy to clipboard |
Posted by: k_k_grass Posted on: 2003-06-08 12:28 哦,非常感谢! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |