SysSelectDoc.aspx
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:8k
源码类别:

.net编程

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="SysSelectDoc.aspx.cs" Inherits="Workflow_SysSelectDoc" %>
  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.      <base target="_self" />
  7.     <link type="text/css" href="style/formbody.css" rel="stylesheet" />
  8.     <link type="text/css" href="style/gridStyle.css" rel="Stylesheet" />
  9.     <script language="javascript" type="text/javascript">
  10.     
  11.     function ReplaceBacksLash(sDoc)
  12.     {
  13.        var a= sDoc.split('\');
  14.        for (var i=0;i<a.length;i++)
  15.        {
  16.             if (i==0)
  17.             {
  18.                 sDoc = a[i];
  19.             }
  20.             else 
  21.             {
  22.                 sDoc = sDoc + "^" + a[i];
  23.              }
  24.          }
  25. //         alert(sDoc);
  26.          return sDoc;   
  27.     }
  28.     
  29.     function AddItem (ListBox2Object,ListBox1Object) //添加指定项
  30.     {
  31.          var selIndex=ListBox1Object.selectedIndex; //选定行的索引
  32.      if(selIndex==-1)
  33.             alert("请选择一项");
  34.     else
  35.     {
  36.         DelAllItem(ListBox2Object);
  37.         var strText=ListBox1Object.options[selIndex].text;
  38.         var strValue=ListBox1Object.options[selIndex].value;
  39.         for(i=0;i < ListBox2Object.options.length;i++)
  40.           {
  41.             if(strText==ListBox2Object.options[i].text || strValue==ListBox2Object.options[i].value)
  42.             {
  43.                 alert("不可添加重复的项!");
  44.                 return;
  45.             }
  46.            }  
  47.     
  48.         var oItem=document.createElement("option");
  49.         oItem.text=strText;
  50.         oItem.value=strValue;
  51.         ListBox2Object.add(oItem);
  52.            var UserRoleText=document.getElementById("HSelectedText").innerText;
  53.            var RoleIDValue=document.getElementById("HSelectedValue").innerText;
  54.             for(i=0;i<ListBox2Object.options.length;i++)
  55.              { 
  56.                  var strText=ListBox2Object.options[i].text;
  57.                  var strValue=ReplaceBacksLash(ListBox2Object.options[i].value);
  58.                  UserRoleText=UserRoleText + strText;
  59.                  RoleIDValue=RoleIDValue + strValue;
  60.              }
  61.            document.getElementById("HSelectedText").innerText=UserRoleText;
  62.            document.getElementById("HSelectedValue").innerText=RoleIDValue;
  63.        
  64.        }
  65.       
  66.     }
  67.     function  DelAllItem(ListBox2Object)  //删除全部
  68.     {
  69.      var rows=ListBox2Object.options.length;
  70.      for(i=rows-1;i>=0;i--)
  71.        { 
  72.           ListBox2Object.options.remove(i);
  73.          
  74.        }
  75.          document.getElementById("HSelectedValue").innerText="";
  76.          document.getElementById("HSelectedText").innerText="";
  77. //    if(rows==0)
  78. //      alert("已全部删除!");
  79.     }
  80.     function DelItem(ListBox2Object)  //删除指定项
  81.     {
  82.      var selIndex=ListBox2Object.selectedIndex;
  83.      if(selIndex==-1)
  84.          alert("请选择一项后再删除!");
  85.        else  
  86.          {
  87.            var RoleTexxt= ListBox2Object.options[selIndex].text;
  88.            ListBox2Object.options.remove(selIndex);
  89.            var  str= document.getElementById("HSelectedValue").innerText;
  90.            
  91.             var UserRoleText=document.getElementById("HSelectedText").innerText;
  92.            var RoleIDValue=document.getElementById("HSelectedValue").innerText;
  93.             for(i=0;i<ListBox2Object.options.length;i++)
  94.              { 
  95.                  var strText=ListBox2Object.options[i].text;
  96.                  var strValue=ReplaceBacksLash(ListBox2Object.options[i].value);
  97.                  UserRoleText=UserRoleText + strText + ",";
  98.                  RoleIDValue=RoleIDValue + strValue + ",";
  99.              }
  100.            document.getElementById("HSelectedText").innerText=UserRoleText;
  101.            document.getElementById("HSelectedValue").innerText=RoleIDValue;
  102.          }
  103.     }
  104.     </script>
  105. </head>
  106. <body>
  107.     <form id="form1" runat="server">
  108.     <div>
  109.     <table cellspacing="0" cellpadding="0" width="480" border="0" style="text-align:center;" >
  110.     <tr>
  111.         <td>
  112.             <fieldset>
  113.             <legend style="text-align:left;">
  114. <img alt="本活动选择可编辑的文挡模板" src="image/DateTime.gif" style="text-align:center; border:0;"/>本活动选择可编辑的文挡模板
  115. </legend>
  116.             <table>
  117.                 <tr>
  118.             <td style="height:10; width:10;"></td>
  119.             <td align="left" style="width:400;"></td>
  120.             </tr>
  121.             <tr style="height:18;">
  122.             <td style="height:18;">
  123.             <table>
  124.                 
  125.             </table>
  126.             </td>
  127.             </tr>
  128.             <tr style="height:18;">
  129.             <td style="height:18;">
  130.             <table>
  131.                 <tr>
  132.                 <td>可选择
  133.                 </td>
  134.                 <td>
  135.                 
  136.                 </td>
  137.                 <td>已选择
  138.                 </td>
  139.                 <td>
  140.                 </td>
  141.                 <td>
  142.                 </td>
  143.                 <td>
  144.                 </td>
  145.                 </tr>
  146.                 <tr>
  147.                 <td>
  148.                     <asp:listbox id="lbDoc" runat="server" Height="350px" Width="300px" SelectionMode="Multiple"
  149. CssClass="input"></asp:listbox>
  150.                 </td>
  151. <td align="center">
  152. <input id="HListDoc" type="hidden" name="ListDoc" runat="server"/>
  153.                             <input id="HEditDoc" type ="hidden" name ="HEditDoc" runat="server" />
  154.                             <br/> 
  155.                             <input id="BT_AddOne" type="button" runat="server" style="width:75px;" value="添加>" onclick="javascript:AddItem(body.all.LstDoc,body.all.lbDoc)" /><br/>
  156.                             <input id="BT_DelOne" type="button" runat="server" style="width:75px;" value="<删除" onclick="javascript:DelItem(body.all.LstDoc)" /><br/>
  157.                                 &nbsp;<input id="HSelectedValue" type="hidden" runat="server" name="HSelectedValue" />
  158.                             <input id="HSelectedText" type="hidden" runat="server" name="HSelectedText" />
  159.                             </td>
  160.                 <td>
  161.                     <asp:listbox id="LstDoc" runat="server" Height="350px" Width="300px" SelectionMode="Multiple"
  162. CssClass="input"></asp:listbox>
  163.                 </td>
  164.                 <%--<td>
  165.                     <asp:ImageButton id="ImgDoc" runat="server" ImageUrl="image/ch.gif" OnClick="ImgDoc_Click"></asp:ImageButton>
  166.                 </td>
  167.                 <td>
  168.                     <asp:ImageButton id="DeleteDoc" runat="server" ImageUrl="image/deleteb.gif" OnClientClick="javascript:return DeleteDoc();"></asp:ImageButton>
  169.                 </td>
  170.                 <td>
  171.                     <asp:ImageButton id="EditDoc" runat="server" ImageUrl="image/handle.gif" OnClientClick="javascript:return OpenWindowDoc();"></asp:ImageButton>
  172.                 </td>--%>
  173.                 </tr>
  174.             </table>
  175.             </td>
  176.             </tr>
  177.             </table> 
  178.           </fieldset>
  179.        </td>
  180.             </tr>
  181.             <tr style="height:20px;"></tr>
  182.             <tr>
  183.        <td>
  184.            <table cellspacing="0" cellpadding="0" width="100%" border="0">
  185.     <tr>
  186.     <td colspan="2" style="height:10"></td>
  187.     </tr>
  188.     <tr>
  189.     <td align="right">
  190.     <asp:ImageButton id="ImgOK" runat="server" ImageUrl="image/confirm.gif" OnClick="ImgOK_Click" ></asp:ImageButton></td>
  191.     <td align="center">
  192.     <asp:ImageButton id="ImgCancel" runat="server" ImageUrl="image/cancel.gif" OnClientClick="javascript:if(confirm('系统提示:您确定退出选择吗?')) window.close();"></asp:ImageButton></td>
  193.     </tr>
  194.     </table>
  195.        </td>
  196.             </tr>
  197.     </table> 
  198.     </div>
  199.     </form>
  200. </body>
  201. </html>