<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="delIP.aspx.cs" Inherits="ZYDN.Web.system.myWeb.delIP" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>删除IP段</title>
    <link rel="stylesheet" type="text/css" href="../skins/css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/myWeb.css" />
	<link rel="stylesheet" type="text/css" href="../skins/css/Sys.css" />
	<script language="javascript" type="text/javascript" src="../js/JFramework.js"></script>
	<script language="javascript" type="text/javascript" src="../js/Sys.js"></script>
	<script language="javascript" type="text/jscript" >
	    function allSelect(){
	        var objs=$name("setIP");
	        var myObj=$("allIP");
	        for (var i=0;i<objs.length;i++){
	            objs[i].checked=myObj.checked;
	            
	            
	        }
	        
	        
	    }
	    
	    
	    function  delobj(){
	    
	        var objAjax=new JAjax();
    	    var objs=$name("setIP");
    	    var idList="";
	        for (var i=0;i<objs.length;i++){
	          if (objs[i].checked){
	                idList+=objs[i].value+",";
	          } 
	        }
	        if (idList==""){return;}
	        idList=idList.substr(0,idList.length-1);
	        var objResponse=new JHttpResponse();
			objResponse.write("idList",idList);
			var out=objAjax.getText("post","delIP.aspx?type=del",objResponse,null);
			if(out!="1"){alert(out);return;}
			
			var trObjs=document.getElementsByTagName("TR");
			var delList=new Array();
			
			for (var i=0;i<trObjs.length;i++){
			    var box=trObjs[i].getElementsByTagName("INPUT")[0];
			    if (box.checked){
			       delList[delList.length]=trObjs[i];
			    }
			}
			
			var l=delList.length;
			for (var i=0;i<l;i++){
			 
			    delList[i].removeNode(true);
			 //   alert(i+"\n"+ l+"\n"+delList[0].outerHTML);
			}
			
	        
	    }
	
	</script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width:450px; height:250px; overflow:scroll;">
    <table ><tr><td>  <input type="checkbox"  id="allIP" name="allIP" onclick="allSelect()" /> 地区</td><td>包含IP段数</td></tr>
        <asp:Repeater ID="IPlist" runat="server">
         <ItemTemplate>
        <tr>
        <td>
          <input type="checkbox" value="<%# DataBinder.Eval(Container, "DataItem.id")%>" id="setIP" name="setIP">
            <%# DataBinder.Eval(Container, "DataItem.addname")%>
        </td><td>
          <%# DataBinder.Eval(Container, "DataItem.num")%>
        </td></tr>
        
        </ItemTemplate>
        
        </asp:Repeater>
        </table>
    </div>
    <div style="width:450px; text-align:center; padding-top:5px;">
    <input type="button" value="删除" onclick="delobj()" />
    
    </div>
    </form>
</body>
</html>
