Javascript实现部门人员勾选

<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ page import="com.ipacssh.truct.bean.Userinfo"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@page import="java.text.SimpleDateFormat" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>选择页面</title>
</head>
<link href="jsp/css/style.css" rel="stylesheet" type="text/css" /><link href="jsp/css/lianav3.css" rel="stylesheet" type="text/css" /><link href="jsp/css/cssmain.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

 function selectBox(obj,bopgIDs){
        var checkboxis = document.getElementsByName(bopgIDs);
 
         if(obj.checked==true){
           
              for (var i=0; i<checkboxis.length; i++){
                 //alert(checkboxis[i].checked);               
                 checkboxis[i].checked = true;
           }
          
         }else{
           
             for (var i=0; i<checkboxis.length; i++){
                //alert(checkboxis[i].checked);               
                checkboxis[i].checked = false;
             }
         }
   
  }
 function countselect(){
        var checkboxis = document.getElementsByName("member");
  var mobiles=window.opener.document.getElementById("receiver_mobile");
  var receiver=window.opener.document.getElementById("receiver");
        var member="";
        var mobileno="";
 
              for (var i=0; i<checkboxis.length; i++){
                 //alert(checkboxis[i].checked);               
                 if(checkboxis[i].checked){
                var str=checkboxis[i].value.split("|");
                if(str[1]==""){
       alert("用户"+str[0]+"通讯录中没有填写手机号!");
       return false;
       }else{
        if(member==""){
                  member=""+str[0];
                  }else{
                  member=member+","+str[0];
                  }
             
              if(mobileno==""){
                  mobileno=""+str[1];
                  }else{
                  mobileno=mobileno+","+str[1];
                  }   
                 
                 }
      }
           }
          
           //alert(mobileno+member);
     mobiles.value=mobileno;
     receiver.value=member;
    
     //alert(mobiles.value+receiver.value);
          
 }
  
  
 </script>

<body leftmargin="6">
<table width="150" border="1" align="center" cellspacing="0" bordercolor="#FFFFFF" class="border">
  <!--DWLayoutTable-->
  <tr>
    <td height="32" colspan="3"><strong>请选择接收人:</strong></td>
  </tr>
  <tr>
    <td height="32" colspan="3"><input type="button" onclick="countselect();" value="确 认" />
      &nbsp;
      <input name="button" type="button" onclick="self.close();" value="关 闭" /></td>
  </tr>
  <logic:notEmpty name="derplist"> <logic:iterate id="derp" name="derplist" indexId="ind">
  <tr>
    <td width="24" height="18" valign="middle" align="center"> <input type="checkbox" name="de${derp.id}" onclick="selectBox(this,'de${derp.id}');" id='de${derp.id}' value="checkbox"/>
    </td>
    <td height="18" colspan="2" align="left" valign="middle"><b>${derp.deparName}</b>&nbsp;</td>
  </tr>
  <logic:notEmpty name="masterlist"> <logic:iterate id="master" name="masterlist" indexId="ind">
  <c:if test="${derp.id==master.departName}">
  <tr>
    <td width="24" height="18"  valign="top">&nbsp;&nbsp;&nbsp;&nbsp; </td>
    <td width="21" height="18" align="center"  valign="middle"> <input type="checkbox" name="member" id="de${derp.id}" value="${master.truename}|${master.mobile}"/>
    </td>
    <td width="100"  valign="top">${master.truename}</td>
  </tr>
  </c:if> </logic:iterate > </logic:notEmpty> </logic:iterate > </logic:notEmpty>
  <tr>
    <td height="32" colspan="3"><input type="button" onclick="countselect();" value="确 认" />
      &nbsp; <input name="button2" type="button" onclick="self.close();" value="关 闭" /></td>
  </tr>
 
</table>
</body>
</html>

你可能感兴趣的:(JavaScript,bean,struts,css,mobile)