Http://www.cnblogs.com/wifi/articles/2387131.html
Refer to jquery First
HTML Section---------------------------------
<form>
<table>
<tr>
<TD align= "center" ><input id= "T1" type= "text" size= "5" msg= "name"/> </td>
<TD align= "center" ><input id= "T2" type= "text" size= "5" msg= "gender"/></td>
<TD align= "center" ><input id= "T3" type= "text" size= "5" msg= "Age"/></td>
<TD align= "center" ><input id= "T4" type= "Text" size= "5" msg= "Address"/></td>
<TD align= "center" ><input id= "T5" type= "text" size= "5" msg= "Mailbox"/></td>
<TD align= "center" ><input id= "T6" type= "text" size= "5" msg= "province"/></td>
</tr>
<tr>
<TD align= "center" ><input type= "Submit" onclick= "return Checknull ()"/></td>
</tr>
</table>
<form>
JS Part------------------------
<script type= "Text/javascript" >
function Checknull ()
{
var num=0;
var str= "";
$ ("input[type$= ' text ']"). each (function (n) {
if ($ (this). val () = = "")
{
num++;
str+= "?" +$ (This). attr ("msg") + "cannot be empty!" \ r \ n ";
}
});
if (num>0)
{
alert (str);
return false;
}
Else
{
return true;
}
}
</script>
Use jquery to implement a submit form to verify that the text box is empty