<html> <head> <meta http-equiv=
"Content-Type" content=
"text/html; charset=gbk"> <script type=
"text/javascript" src=
"/sunchis/script/jquery-1.3.2.js"></script> <script type=
"text/javascript"> $(document).ready(
function(){ $(
":submit[id=tijiao]").click(
function(check){
var val = $(
":text[id=test]").val();
if(val==
""){ alert(
"文本框输入为空,不能提交表单!"); $(
":text[id=test]").focus(); check.preventDefault(); } }); }); </script> <title>jQuery禁止提交表单</title> </head> <body> <form action=
"index.htm" method=
"post"> <input type=
"text" name=
"test" id=
"test"> <input type=
"submit" id=
"tijiao" value=
"提交"> </form> </body> </html>