<html> <script> function validate(){ var username = document.f1.username.value; if(username == ""){ alert("用户名不能为空"); return false; } } </script> <body> <form name="f1" method="post" onsubmit="return validate();"> <input type="text" name="username"> <input type="submit" type="提交"> </form> </body></html>
现在这里如果return false的话,form还是提交了一下,请问如何让它不提交??