日期:2014-05-16  浏览次数:20410 次

jquery判断复选框是否选中代码无效

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
 <script type="text/javascript" src="<%=basePath%>easyui/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#backorder").click(function(){
//alert($("#tem:checked").attr("checked"));
var checkBox =$("input[type='checkbox'][name='extraservice']:checked").attr("checked");
alert(checkBox);
if(checkBox){
var allType=$("input[type='checkbox'][name='extraservice']:checked");
var v="";
  for(var i = 0; allType && i < allType.length; i++) {  
 
  if("1"==$(allType[i]).val()){
  //提醒用户是否退订基本套餐
  if(confirm("基本套餐退订后服务将不能再使用了,确定要这么做吗")){
  //alert("这里也要生成记录===");
  $.ajax({  
  type: "POST",
  url: "<%=basePath%>backorders!modifyOrder.action",
  async:false,  
  data: "fEXTRASERVICE="+$(allType[i]).val()+"&fACCOUNT="+$("#fACCOUNT").val()+"&type="+$("#type").val()+"&mainservice=1",
  success: function(){
  //alert("你的产品已经定制成功,管理员审核后套餐自动生效");
  }
 
  }); 
  }
  }else{
  //alert("这里要生成记录");
  $.ajax({  
  type: "POST",
  url: "<%=basePath%>backorders!modifyOrder.action",
  async:false,  
  data: "fEXTRASERVICE="+$(allType[i]).val()+"&fACCOUNT="+$("#fACCOUNT").val()+"&type="+$("#type").val()+"&mainservice=0",
  success: function(){
  //alert("你的产品已经定制成功,管理员审核后套餐自动生效");
  }
 
  }); 
  }
   
  } 
  alert("退订将在下月生效");
   
}else{
alert("请选择一种套餐");
}
});
});

</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>产品退订</title>
<!-- <link rel='stylesheet' type='text/css' href='<%=basePath%>css/public.css' />
<SCRIPT language=JavaScript src="<%=basePath%>JS/pulic.js"></SCRIPT> -->

<style type="text/css">
table {
border-collapse: collapse;
}
#Layer1 {
position: absolute;
width: 200px;
height: 115px;
z-index: 1;
}

.td_head {
border-top-width: 1px;
border-bottom-width: 1px;
border-top-style: solid;
border-right-style: none;
border-bottom-style: solid;
border-left-style: none;
border-top-color: #CCCCCC;
border-bottom-color: #CCCCCC;
}

.boderc {
border: 1px solid #CCCCCC;
}

.text_W_H {
height: 18px;
width: 60px;
}

.hj {
line-height: 20px;
}

.combox_W {
width: 125px;
}

.boddou {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #CCCCCC;