【发布时间】:2014-02-12 14:03:17
【问题描述】:
我有 html 表格,请参阅下面的 html 表格,如果用户单击标题中的图像,它不会重定向它显示警报“请取消选中所有复选框”,如果用户取消选中所有复选框,它只会重定向.我的问题是它现在重定向,因为第一个 td 未选中,如果第一个 td 被选中,它会显示警报,它只接受第一个 td 我想获取所有 td。任何一个指南都可以。请参阅下面的代码
ajax
<script>
$(document).ready(function() {
$("#redirect").click(function() {
var chkBox=$("#checkAddress");
if (chkBox.attr('checked') != 'checked')
{
var clientid=document.getElementById("client").value;
$.blockUI(
{
message: '<h2>Please wait...</h2><img src="/image/loader.gif" />',
timeout: 2000
});
$.ajax({
type:"post",
data:"clientid="+clientid,
success:function(data){
window.location = '?action=clientpricenotification&clientid='+clientid+'';
$("#result").html(data);
$('.blockUI').hide();
}
});
}
else
{
alert("Please uncheck all the td");
}
});
});
</script>
html
<th style="text-align:center ;width:200px">Route Update</th>
<th style="text-align:center ;width:90px">By(Emp)</th>
<th style="text-align:center ; width:32px"> <img id='redirect' src="/image/Picture12.png" style="margin:0px;cursor:pointer;"> </th>
echo ' <td style="width:200px" id="CPH_GridView1_Status1'.$rows['id'].'" class="route status1 '.$rows["id"].' "><input type="checkbox" style="margin:0 0 0 93px;" id="checkAddress" '.$checked_value.' name="checkAddress" '.$checked_value.' ></td>
<td id="CPH_GridView1_user" style="width:90px" class="edit user '.$rows["id"].'">'.$rows["user"].'</td>
<td style="width:65px" class=" '.$rows["id"].'"></td>';
【问题讨论】:
标签: php jquery html ajax checkbox