亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery 必填項(xiàng)判斷表單是否為空的方法

 更新時(shí)間:2008年09月14日 20:42:33   作者:  
jquery 表單驗(yàn)證,檢測(cè)表單是否為空
html頁(yè)面
復(fù)制代碼 代碼如下:

<form onsubmit="if(confirm('確定好你所填寫的正確,不然會(huì)發(fā)錯(cuò)!')) {return checkForm();}else{return false;}" >
<table >
<tr>
<td>選擇發(fā)送人<font class="red">*</font></td>
<td>
<input type="text" name="sendto_type[]" id="sendto_type1" value="1" >按城市發(fā)送

</td>
</tr>

<tr>
<td>選擇發(fā)送人2<font class="red">*</font></td>
<td>
<input type="text" name="sendto_type[]" id="sendto_type1" value="1" >按城市發(fā)送
</td>
</tr>
</table>
</form>

js代碼
復(fù)制代碼 代碼如下:

<script>
function checkForm() {
pass = true;
$("td:contains('*')").next().find("input").each(function(){
if(this.value == '') {
text = $(this).parent().prev().text();
alert(text+"是必填項(xiàng)");
this.focus();
pass = false;
return false;//跳出each
}
});
return pass;
}
</script>

相關(guān)文章

最新評(píng)論