⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select_dep.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%@ Language=VBScript.Encode %>
<%
	Response.Expires=0
	Response.Buffer=true
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css">
<title>选择部门</title>
<SCRIPT LANGUAGE=javascript>
<!--

function window_onload() {
	window.returnValue = '';
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=window EVENT=onload>
<!--
 window_onload()
//-->
</SCRIPT>
<script Language="JavaScript">

function InsertItem(ObjID, Location)
{
  len=document.form1.elements[ObjID].length;
  for (counter=len; counter>Location; counter--)
  {
    Value = document.form1.elements[ObjID].options[counter-1].value;
    Text2Insert  = document.form1.elements[ObjID].options[counter-1].text;
    document.form1.elements[ObjID].options[counter] = new Option(Text2Insert, Value);
  }
}
function GetLocation(ObjID, Value)
{
  total=document.form1.elements[ObjID].length;
  for (pp=0; pp<total; pp++)
    if (document.form1.elements[ObjID].options[pp].text == "---"+Value+"---")
    { return (pp);
      break;
    }
  return (-1);
}

function GetObjID(ObjName)
{
  for (var ObjID=0; ObjID < window.form1.elements.length; ObjID++)
    if ( window.form1.elements[ObjID].name == ObjName )
    {  return(ObjID);
      break;
    }
  return(-1);
}

function AddItem(ObjName, DesName, CatName)
{
  //GET OBJECT ID AND DESTINATION OBJECT
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
//  window.alert(document.form1.elements[DesObjID].length);
  k=0;
  i = document.form1.elements[ObjID].options.length;
  if (i==0)
    return;
  maxselected=0
  for (h=0; h<i; h++)
    if (document.form1.elements[ObjID].options[h].selected ) {
        k=k+1;
        maxselected=h+1;
        }
  if (maxselected>=i)
    maxselected=0;
  if (CatName != "")
    CatObjID = GetObjID(CatName);
  else
    CatObjID = 0;
  if ( ObjID != -1 && DesObjID != -1 && CatObjID != -1 )
  { jj = document.form1.elements[CatObjID].selectedIndex;
    if ( CatName != "")
    { CatValue = document.form1.elements[CatObjID].options[jj].text;
      CatCode  = document.form1.elements[CatObjID].options[jj].value;
    }
    else
      CatValue = "";
    i = document.form1.elements[ObjID].options.length;
    j = document.form1.elements[DesObjID].options.length;
    for (h=0; h<i; h++)
    { if (document.form1.elements[ObjID].options[h].selected )
      {  Code = document.form1.elements[ObjID].options[h].value;
        Text = document.form1.elements[ObjID].options[h].text;
        j = document.form1.elements[DesObjID].options.length;
        if (Text.indexOf('--')!=-1) {
            for (k=j-1; k>=0; k-- ) {
              document.form1.elements[DesObjID].options[k]=null;
            }
            j=0;
        }
        if (Text.substring(0,1)=='-' && Text.substring(1,2)!='-') {
            for (k=j-1; k>=0; k-- ) {
              if (((document.form1.elements[DesObjID].options[k].value).substring(0,2))==(Code.substring(0,2)))
                document.form1.elements[DesObjID].options[k]=null;
            }
            j= document.form1.elements[DesObjID].options.length;
        }
        HasSelected = false;
        for (k=0; k<j; k++ ) {
          if ((document.form1.elements[DesObjID].options[k].text).indexOf('--')!=-1){
              HasSelected = true;
              window.alert('已经包括本选项:'+Text);
              break;
          }else if ((document.form1.elements[DesObjID].options[k].text).indexOf('-')!=-1 && ((document.form1.elements[DesObjID].options[k].value).substring(0,2)==Code.substring(0,2))){
              HasSelected = true;
              window.alert('已经包括本选项:'+Text);
              break;
          }
          if (document.form1.elements[DesObjID].options[k].value == Code)
          {  HasSelected = true;
              break;
          }
        }
        if ( HasSelected == false)
        { if (CatValue !="")
          { Location = GetLocation(DesObjID, CatValue);
            if ( Location == -1 )
            { document.form1.elements[DesObjID].options[j] =  new Option("---"+CatValue+"---",CatCode);
              document.form1.elements[DesObjID].options[j+1] = new Option(Text, Code);
            }//if
            else
            { InsertItem(DesObjID, Location+1);
              document.form1.elements[DesObjID].options[Location+1] = new Option(Text, Code);
            }//else
          }
          else
            document.form1.elements[DesObjID].options[j] = new Option(Text, Code);
        }//if
        document.form1.elements[ObjID].options[h].selected =false;
      }//if
    }//for
    document.form1.elements[ObjID].options[maxselected].selected =true;
  }//if
}//end of function

function DeleteItem(ObjName)
{
  ObjID = GetObjID(ObjName);
  minselected=0;
  if ( ObjID != -1 )
  {
    for (i=window.form1.elements[ObjID].length-1; i>=0; i--)
    {  if (window.form1.elements[ObjID].options[i].selected)
      { // window.alert(i);
          if (minselected==0 || i<minselected)
            minselected=i;
          window.form1.elements[ObjID].options[i] = null;
      }
    }
    i=window.form1.elements[ObjID].length;

    if (i>0)  {
        if (minselected>=i)
          minselected=i-1;
        window.form1.elements[ObjID].options[minselected].selected=true;
        }
  }
}
function DeleteAllItem(ObjName)
{
 	ObjID = GetObjID(ObjName);
	for (m=window.form1.elements[ObjID].length-1;m>=0;m--){
		window.form1.elements[ObjID].options[m]=null;
		}
}
function AddAllItem(ObjName, DesName, CatName)
{
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
  for (m=window.form1.elements[DesObjID].length-1;m>=0;m--){
	window.form1.elements[DesObjID].options[m]=null;
	}
  for (m=window.form1.elements[ObjName].length-1;m>=0;m--)
  	{
  	window.form1.elements[DesObjID].options[m]=new Option(window.form1.elements[ObjID].options[m].text,window.form1.elements[ObjID].options[m].value)
  	}
}
		
</script>





</head>
<%
Deplist=request.QueryString("Deplist")						
%>

<div class="TitleBar"> </div>
<form method=post name=form1 id=form1 action="">
<table width="500" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td class="tdBottom"><table width=98% border=0 align=center cellpadding=2 cellspacing=1 class="tab" style="Margin:5px 5px 5px 5px">

          <tr class=InputFrameLine> 
            <td  class='tdTop2'><img border="0" src="../images/icon_title.gif" align="left">选择部门
              <input type=hidden name=infoid value="<%=request("userid")%>"></td>
          </tr>
          <tr class=InputFrameLine> 
            <td class=tdBottom><table width=100% class=tableframe>
              <tr align=center class=listtitle>
                <td class=listcelltitle width="240">&nbsp; </td>
                <td class=listcelltitle width="40">&nbsp;</td>
                <td class=listcelltitle width="240"><nobr>已选职位</nobr></td>
              </tr>
              <tr align=center>
                <td>
                  <select name=Dept size=9 id="Dept" style="width: 100%" rows=9 ondblclick="JavaScript:AddItem('Dept','SDept', '')">
                    <%Call pOptions("tbioadepartment","Name",0,0,"")%>
                    <%
						set rs=Server.CreateObject("ADODB.RecordSet")
						sql="select * from tbioadepartment"
						rs.open sql,oConn,1,1
						while not rs.eof
						%>
                    <option value='<%=rs("id")%>'><%=rs("name")%></option>
                    <%
						rs.MoveNext
						wend
						rs.close
						set rs=nothing
						%>
                  </select>
                </td>
                <td valign=center width=40> <span valign=center>
                  <input  name=insert1 type=button id="insert1" onClick="JavaScript:AddItem('Dept','SDept', '')" value="&gt;" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                  <hr>
                  <input  name=insert type=button  id="insert" onClick="JavaScript:AddAllItem('Dept','SDept', '')" value="&gt;&gt;" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                  <hr>
                  <input name=delall type=button class="button0" id=bsall2 style="font-weight: bold; width: 32" onMouseOver=className="button1" onMouseOut=className="button0" value="&lt;"  onClick="JavaScript:DeleteItem('SDept')">
                  <hr>
                  <input type=button value="&lt;&lt;"  name=del onClick="JavaScript:DeleteAllItem('SDept')" style="font-weight: bold; width: 32" class="button0" onMouseOut=className="button0" onMouseOver=className="button1">
                </span> </td>
                <td class=row>
                  <select id=SDept name=SDept  size=9 rows=9 style="width: 100%" ondblclick="JavaScript:DeleteItem('SDept')">
                    <%
                      if trim(Deplist)<>"" then
			sql="select * from tbioadepartment"							
			rs.Open sql,Oconn,1,1
			do while not rs.eof %>
                    <option value='<%=rs("id")%>'> <%=rs("name")%></option>
                    <%
				rs.MoveNext
			loop
			rs.Close
			set rs=nothing
			end if	%>
                  </select>
                </td>
              </tr>
            </table></td>
          </tr>
          <tr class=InputFrameButtonLine> 
            <td align="center" class="tdBottom"> <input type=hidden name=rolelist value=""> 
			<input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=确定 name="bQD" id="bQD" onclick="re_role()"> 
              <input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=放弃 name="bFQ" id="bFQ" onclick="JavaScript:window.close()"> 
            </tr>

      </table></td>
  </tr>
</table> 
</form>
<script language="JavaScript">
<!--
var temp1=document.form1.SDept;
var str1,str2;
function re_role()
{	
	var str1,str2;
	str1="";
	str2="";
	for (i=0;i<temp1.options.length;i++)
		{
		str1+=temp1.options[i].value+' ';
		str2+=temp1.options[i].text+' ';
		}
	window.returnValue=str1+'|'+str2;
	window.close();
		
}
//-->
</script>

<%
	set rs = nothing
	oConn.Close
	set oconn = nothing
%>
</BODY>
</html>
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -