首页 > 代码库 > Struts动态联动效果

Struts动态联动效果

<%@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="http://www.mamicode.com//common/css/mainStyle.css"type="text/css" />        <script type="text/javascript" src="http://www.mamicode.com//common/jquery/jquery-1.4.2.min.js"></script>        <script type=‘text/javascript‘ src=http://www.mamicode.com/‘/common/js/common.js‘></script>"text/javascript" src="http://www.mamicode.com//common/js/steppage.js"></script>        <script type="text/javascript" src="http://www.mamicode.com//common/js/xjValidate.js"></script>        <script type="text/javascript" src="http://www.mamicode.com//common/My97DatePicker/WdatePicker.js"></script>    </head>  <body>    <form action="<%=ctx %>/user!add.action" name="form" id="infoForm" method="post" >    <input type="hidden" value="http://www.mamicode.com/${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="http://www.mamicode.com/${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="http://www.mamicode.com/${lzuser.lzUsersPass}" />                    </td>                    <td class="nowrap">姓名</td>                    <td class="left">                        <input type="text" name="lzuser.lzEmpName"  value="http://www.mamicode.com/${lzuser.lzEmpName}" />                    </td>                        <td class="nowrap">级别</td>                    <td  class="left" >                         <select name="lzuser.lzV1" onchange="gsbm(this)">                             <option value="">请选择</option>                             <option value="http://www.mamicode.com/1">局级</option>                             <option value="http://www.mamicode.com/2">公司</option>                             <option value="http://www.mamicode.com/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="http://www.mamicode.com/---请选择---" listKey="lzCompanyId" listValue="http://www.mamicode.com/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="http://www.mamicode.com/---请选择---" listKey="lzCompanyId" listValue="http://www.mamicode.com/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="http://www.mamicode.com/提    交"  />                        <input type="reset"  class="btn_standard"  name="reset" value="http://www.mamicode.com/重    置" />                    </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="http://www.mamicode.com/list" status="i">        <tr class="tabtd1"  onm ouseOver="this.style.background=‘#d2eefa‘"  onm ouseOut="this.style.background=‘‘">            <td class="center_align"><s:property value="http://www.mamicode.com/#i.count"/></td>            <td class="center_align"><s:property value="http://www.mamicode.com/#user.lzUsersName"/></td>            <td class="center_align"><s:property value="http://www.mamicode.com/#user.lzEmpName"/></td>            <td class="center_align"><s:property value="http://www.mamicode.com/#user.lzV3"/></td>            <td class="center_align"><s:property value="http://www.mamicode.com/#user.lzV4"/></td>            <td class="center_align"><s:property value="http://www.mamicode.com/#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="http://www.mamicode.com/user!editShow.action?id=nbsp;                <a href="http://www.mamicode.com/user!Delete.action?id=    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动态联动效果