我有html表格,请参阅下面的html表格,如果用户单击标题中的图像,它将不会重定向它显示警报“请取消选中所有复选框”,它的唯一的重定向如果用户没有选中所有的复选框。我的问题是它现在重定向,因为第一个td未选中,它显示警报,如果第一个td检查,它只能采取第一个td我想采取所有td .can任何一个导是我的。见下面的代码如果所有复选框未选中,如何重定向到下一页
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>';
感谢我尝试了我你不能工作,你可以改变代码 – arok