码迷,mamicode.com
首页 > 其他好文 > 详细

Struts动态联动效果

时间:2014-10-14 21:48:31      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   java   for   

<%@page contentType="text/html;charset=utf-8"%>
<%@ include file="../../common/include.jsp"%>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" href="<%=ctx %>/common/css/mainStyle.css"type="text/css" />
        <script type="text/javascript" src="<%=ctx %>/common/jquery/jquery-1.4.2.min.js"></script>
        <script type=‘text/javascript‘ src=‘<%=ctx %>/common/js/common.js‘></script>
        <script type="text/javascript" src="<%=ctx %>/common/js/steppage.js"></script>
        <script type="text/javascript" src="<%=ctx %>/common/js/xjValidate.js"></script>
        <script type="text/javascript" src="<%=ctx %>/common/My97DatePicker/WdatePicker.js"></script>
    </head>
  <body>
    <form action="<%=ctx %>/user!add.action" name="form" id="infoForm" method="post" >
    <input type="hidden" value="${lzuser.lzUsersId}" name="lzuser.lzUsersId"/>
            <table width="100%" style="margin-bottom: 20px;">
                <tr class="h_bt" >
                      <td  colspan="8">
                          <span>添加用户</span>
                      </td>
                </tr>
                <tr>
                    <td class="nowrap">用户名</td>
                    <td class="left">
                        <input type="text" name="lzuser.lzUsersName" value="${lzuser.lzUsersName}" /><font color="#ff0000">*</font>&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td class="nowrap">密码</td>
                    <td class="left">
                        <input type="password" name="lzuser.lzUsersPass" value="${lzuser.lzUsersPass} " />
                    </td>
                    <td class="nowrap">姓名</td>
                    <td class="left">
                        <input type="text" name="lzuser.lzEmpName"  value="${lzuser.lzEmpName}" />
                    </td>
                        <td class="nowrap">级别</td>
                    <td  class="left" >
                         <select name="lzuser.lzV1" onchange="gsbm(this)">
                             <option value="">请选择</option>
                             <option value="1">局级</option>
                             <option value="2">公司</option>
                             <option value="3">部门</option>
                         </select>
                    </td>
                </tr>
                <tr>
                
                    <td class="nowrap" id="a0" style="display: none;">公司</td>
                    <td class="left"   id="a1" style="display: none;">
                        <s:select list="#select.queryGS()" name="lzComId1" 
                            headerKey="---请选择---"  headerValue="---请选择---" listKey="lzCompanyId" listValue="lzCompanyName" onchange="loadzw(this)"/>
                    </td>
                    <td class="nowrap" id="a2" style="display: none;">部门</td>
                    <td class="left"   id="a3" style="display: none;">
                         <select id="ndjh" name="lzDepIdId" >
                          </select>
                    </td>
                    <td class="nowrap" id="b0" style="display: none;">公司</td>
                    <td class="left"   id="b1" style="display: none;">
                        <s:select list="#select.queryGS()" name="lzComId" 
                            headerKey="---请选择---"  headerValue="---请选择---" listKey="lzCompanyId" listValue="lzCompanyName"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="6"  class="left"></td>
                    <td colspan="2"  class="left">
                        <input type="button" class="btn_standard"  name="sub" onclick="doSub()" value="提 &nbsp;&nbsp;&nbsp;交"  />
                        <input type="reset"  class="btn_standard"  name="reset" value="重 &nbsp;&nbsp;&nbsp;置" />
                    </td>
                </tr>
            </table>
    </form>
    <div style="height:65% ">
    <form name="delForm" action="" method="POST">
    <table width="100%">
    <tr> 
        <td  width="5%"    class="td_title">序号</td>
        <td  width="15%"     class="td_title">用户名</td>
        <td  width="10%"     class="td_title">姓名</td>
        <td  width="15%"     class="td_title">公司</td>
        <td  width="10%"     class="td_title">部门</td>
        <td  width="10%"     class="td_title">岗位</td>
        <td  width="10%"    class="td_title">操作</td>
    </tr>
    <s:iterator id="user" value="list" status="i">
        <tr class="tabtd1"  onMouseOver="this.style.background=‘#d2eefa‘"  onMouseOut="this.style.background=‘‘">
            <td class="center_align"><s:property value="#i.count"/></td>
            <td class="center_align"><s:property value="#user.lzUsersName"/></td>
            <td class="center_align"><s:property value="#user.lzEmpName"/></td>
            <td class="center_align"><s:property value="#user.lzV3"/></td>
            <td class="center_align"><s:property value="#user.lzV4"/></td>
            <td class="center_align"><s:property value="#user.lzV4"/></td>
            <td class="center_align">
                <a href="javascript:userRole(‘<s:property value="#user.lzUsersId"/>‘)">[授权]</a> &nbsp
                <a href="javascript:userJob(‘<s:property value="#user.lzUsersId"/>‘)">[岗位]</a> &nbsp
                <a href="user!editShow.action?id=<s:property value="#user.lzUsersId"/>">修改</a>&nbsp;
                <a href="user!Delete.action?id=<s:property value="#user.lzUsersId"/>">删除</a>
            </td>
        </tr>    
    </s:iterator>
</table>
</form>
</div>
<script language="javascript">
    function loadzw(gs){
        var url="<%=ctx%>/company!getDep.action?id="+gs.value;     
        $("#ndjh").load(url);
    }
    
    function userRole(id){
        ModelWindow("<%=ctx %>/open!GoUrl.action?path=user!userRolePage.action&id="+id,900,500);
    }
    
    function userJob(id){
        ModelWindow("<%=ctx %>/open!GoUrl.action?path=user!userJobPage.action&id="+id,500,270);
    }
    function doSub(){
        var objarr = new Array(
            ["lzuser.lzUsersName","用户名","notEmpty",""],
            //["lzuser.lzEmpName","角色名称","max","number:"+]
            ["lzuser.lzUsersPass","密码","notEmpty",""],
            ["lzuser.lzEmpName","姓名","notEmpty",""]
        );
        if(xj.CheckAll(objarr)){
            if(confirm("确认提交用户信息?"))
                    document.form.submit();
        }           
    }
     function gsbm(x){
        var y = x.value;
        if(y==3){
            $(‘#a0‘).css(‘display‘,‘block‘);
            $(‘#a1‘).css(‘display‘,‘block‘);
            $(‘#a2‘).css(‘display‘,‘block‘);
            $(‘#a3‘).css(‘display‘,‘block‘);
            $(‘#b0‘).css(‘display‘,‘none‘);
            $(‘#b1‘).css(‘display‘,‘none‘);
        }else if(y==2){
            $(‘#b0‘).css(‘display‘,‘block‘);
            $(‘#b1‘).css(‘display‘,‘block‘);
            $(‘#a0‘).css(‘display‘,‘none‘);
            $(‘#a1‘).css(‘display‘,‘none‘);
            $(‘#a2‘).css(‘display‘,‘none‘);
            $(‘#a3‘).css(‘display‘,‘none‘);
        }else{
            $(‘#a0‘).css(‘display‘,‘none‘);
            $(‘#a1‘).css(‘display‘,‘none‘);
            $(‘#a2‘).css(‘display‘,‘none‘);
            $(‘#a3‘).css(‘display‘,‘none‘);
            $(‘#b0‘).css(‘display‘,‘none‘);
            $(‘#b1‘).css(‘display‘,‘none‘);
        }
    }
//-->
</script>
</body>
</html>
<p:page2 pageName="page" uri="/user!query.action"></p:page2>

 

Struts动态联动效果

标签:style   blog   http   color   io   os   ar   java   for   

原文地址:http://www.cnblogs.com/kennyliu/p/4025062.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!