department_select_chk.aspx
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:3k
源码类别:

OA系统

开发平台:

ASP/ASPX

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="department_select_chk.aspx.cs" Inherits="web_personnel_department_department_select_chk" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5.     <title>无标题页</title>
  6.     <link href="../../../css/style.css" rel="stylesheet" type="text/css" />
  7.     <script language="javascript" type="text/javascript">
  8.         function check(id)
  9.         {
  10.             var current = document.getElementById("chk"+id);
  11.             
  12.             var temp1 = document.getElementsByTagName("input");  
  13.             for(var i=1; i<temp1.length; i++)
  14.             {
  15.                 if(temp1[i].type == "checkbox" && temp1[i].parent==id)
  16.                 {   
  17.                     temp1[i].checked = current.checked;
  18.                     
  19.                     var temp2 = document.getElementsByTagName("input");  
  20.                     for(var j=1; j<temp2.length; j++)
  21.                     {
  22.                         if(temp2[j].type == "checkbox" && ("chk"+temp2[j].parent)==temp1[i].id)
  23.                         {
  24.                             temp2[j].checked = current.checked;
  25.                             
  26.                             var temp3 = document.getElementsByTagName("input");  
  27.                             for(var k=1; k<temp3.length; k++)
  28.                             {
  29.                                 if(temp3[k].type == "checkbox" && ("chk"+temp3[k].parent)==temp2[j].id)
  30.                                 {
  31.                                         temp3[k].checked = current.checked;
  32.                                 }
  33.                             }
  34.                         }
  35.                     }
  36.                 }
  37.             } 
  38.         }
  39.         function sum()
  40.         {
  41.             var flag = "0";
  42.             var menus = "";
  43.             for(var i=0; i<1000; i++)
  44.             {
  45.                 if(document.getElementById("chk"+i)!=null)
  46.                 {
  47.                     if(document.getElementById("chk"+i).checked)
  48.                     {
  49.                         flag = "1"
  50.                         menus = menus+"" + i + ",";
  51.                     }
  52.                 }
  53.             }
  54.             if(flag == "0")
  55.             {
  56.                 alert("請至少選擇一個部門");
  57.                 return false;
  58.             }
  59.             document.all.DepartmentIds.value=menus.substring(0,menus.length-1);
  60.             return true;
  61.         }
  62.     </script>
  63. </head>
  64. <body>
  65.     <form id="form1" runat="server">
  66.     <div>
  67.         <asp:Table ID="TblDepartment" runat="server" BorderWidth="1px">
  68.         </asp:Table>
  69.         <br />
  70.         <center><asp:HiddenField ID="DepartmentIds" runat="server"></asp:HiddenField>
  71.         <asp:Button ID="BtnOk" runat="server" Text="確定" OnClick="BtnOk_Click" OnClientClick="return sum()" /></center>
  72.     </div><br />
  73.     </form>
  74. </body>
  75. </html>