看我编写的办公一个例子:绝对全乐!

发表于:2007-06-30来源:作者:点击数: 标签:
!-- --------------------------------------------------------- - Title : 天路办公系统 - Desc: asp+com的标准办公系统 - Ver: Ver1.0 - Author: zxn(comezxn@163.com) - LastUpdate: 2002-3-29 --------------------------------------------------------
<!--
---------------------------------------------------------
- Title : 天路办公系统
- Desc  : asp+com的标准办公系统
- Ver   : Ver1.0
- Author: zxn(comezxn@163.com)
- LastUpdate: 2002-3-29
---------------------------------------------------------
- Apply in <贸促会办公系统>
- Start at 未定
- Contact with 天乐 (comezxn@163.com)
- This Connection created at 1998-5-16 10:05:59
----------------------------------------------------------
-->
<html>
<head>
<meta HTTP-EQUIV=@#Content-Type@# content=@#text/html; charset=gb2312@#>
<link rel=@#stylesheet@# type=@#text/css@# href=@#/css/css.css@#>
<title>贸促会办公系统</title>
</head>

<script language="JavaScript">
<!--
var onecount;
onecount=0;
subcat = new Array();
        
subcat[0] = new Array("李某","4","4");
        
subcat[1] = new Array("系统管理员","3","2");
        
subcat[2] = new Array("天乐","2","3");
        
subcat[3] = new Array("测试员","1","1");
        
onecount=4;

//改变
function changesection(selectedvalue)
    {
    document.theForm.list1.length = 0;
    var selectid=selectedvalue;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][2] == selectid)
            {
                document.theForm.list1.options[document.theForm.list1.length] = new Option(subcat[i][0], subcat[i][1]);
            }
        }
        
    }    

//初始化列出全部人员
function Listsenction(){
    for (i=0;i < onecount; i++)
        {
         document.theForm.list1.options[document.theForm.list1.length] = new Option(subcat[i][0], subcat[i][1]);
        }
        
    }

//上下移动
//function Singlemove(a,selectedvalue){
//document.theForm.list2.selectedindex=document.theForm.list2.selectedindex+a
//}

//移动
function move(fbox,tbox,order) {
var tempstr1;
var tempstr2;
for(var i=0; i<fbox.options.length; i++) {
if(fbox.options[i].selected && fbox.options[i].value != "") {
var no = new Option();
   if(order==2){
   tempstr1=fbox.options[i].value
   n=tempstr1.indexOf(",");
   tempstr1=tempstr1.substr(0,n);
   no.value = tempstr1;
   tempstr2=fbox.options[i].text
   n=tempstr2.indexOf("-");
   tempstr2=tempstr2.substr(0,n);
   no.text = tempstr2;
   }
   else
   {
   no.value = fbox.options[i].value+",1";
   no.text = fbox.options[i].text+"-阅读";
   }
tbox.options[tbox.options.length] = no;
fbox.options[i].value = "";
fbox.options[i].text = "";
   }
}
BumpUp(fbox);
//if (sortitems) SortD(tbox);
}


function BumpUp(box)  {
var tempstr;
for(var i=0; i<box.options.length; i++) {
if(box.options[i].value == "")  {
for(var j=i; j<box.options.length-1; j++)  {
box.options[j].value = box.options[j+1].value;
box.options[j].text = box.options[j+1].text;
}
var ln = i;
break;
   }
}
if(ln < box.options.length)  {
box.options.length -= 1;
BumpUp(box);
   }
}

//改变
function ChangePath(selecttext,selectvalue){
var tempstr;
for(i=0;i<theForm.list2.length;i++){
    if(theForm.list2[i].selected==true){
    //text
    tempstr=theForm.list2.options[i].text;
    n=tempstr.indexOf("-");
    tempstr=tempstr.substr(0,n);
    theForm.list2.options[i].text=tempstr + "-" +selecttext;
    //value
    tempstr=theForm.list2.options[i].value;
    n=tempstr.indexOf(",");
    tempstr=tempstr.substr(0,n);
    theForm.list2.options[i].value=tempstr+ "," +selectvalue;
  }
}
}


//提交,返回值
function button5_onclick()
{
var str1;
var str2;
str1="";
str2="";
var j;
j=1;
for(i=0;i<theForm.list2.options.length;i++)
     {
      if(j=="1")
        {
        str1=theForm.list2.item(i).text;
        str2=theForm.list2.item(i).value;
        }
       else
        {
        str1=str1+","+theForm.list2.item(i).text;
        str2=str2+"|"+theForm.list2.item(i).value;
        }
        j=j+1;
    }
top.returnValue=str1+"+"+str2;
top.close();
}


function Moveup(dbox) {
for(var i = 0; i < dbox.options.length; i++) {
if (dbox.options[i].selected && dbox.options[i] != "" && dbox.options[i] != dbox.options[0]) {
var tmpval = dbox.options[i].value;
var tmpval2 = dbox.options[i].text;
dbox.options[i].value = dbox.options[i - 1].value;
dbox.options[i].text = dbox.options[i - 1].text
dbox.options[i-1].value = tmpval;
dbox.options[i-1].text = tmpval2;
      }
   }
dbox.selectedIndex=dbox.selectedIndex-1;
}
function Movedown(ebox) {
for(var i = 0; i < ebox.options.length; i++) {
if (ebox.options[i].selected && ebox.options[i] != "" && ebox.options[i+1] !=

ebox.options[ebox.options.length]) {
var tmpval = ebox.options[i].value;
var tmpval2 = ebox.options[i].text;
ebox.options[i].value = ebox.options[i+1].value;
ebox.options[i].text = ebox.options[i+1].text
ebox.options[i+1].value = tmpval;
ebox.options[i+1].text = tmpval2;
      }
   }
ebox.selectedIndex=ebox.selectedIndex+1;
}

/*直接提交
function submitMe(){
//    theForm.userSelect.value=theForm.list1.value
for(i=0;i<theForm.list2.length;i++)
{ theForm.list2[i].selected=true; }
    theForm.submit();
}
*/
//-->
</script>
<body bgcolor="buttonface" onload="Listsenction()">
<form name="theForm" method="post">
<table border="0" cellPadding="0" cellSpacing="0" width="80%" align=center>
  <tr>
    <td height="192" width="608" colspan="2">
    <table border="0" cellPadding="0" cellSpacing="0" align=center>
    <tr>
      <td>
           <select name="section" onchange="changesection(this.options[this.selectedIndex].value)">
         <option value="0" selected>请选择部门列表</option>
         
         <option value="4">办公室</option>
         
         <option value="3">海外经贸事务处</option>
         
         <option value="2">法律事务处</option>
         
         <option value="1">会务处1</option>
         
         </select>
      </td>
      <td></td>
      <td>
           <select name="path" onchange="ChangePath(this.options[this.selectedIndex].text,this.options[this.selectedIndex].value)">
         <option value="0" selected>请选择执行权限</option>
         
         <option value="1">阅读</option>
         
         <option value="2">签字</option>
         
         <option value="3">批复</option>
         
         <option value="4">复函</option>
         
         <option value="5">签发</option>
         
         <option value="6">归档</option>
         
         <option value="7">拟稿</option>
         
         </select>
      </td>
    </tr>
      <tr>
        <td>
          <select multiple name="list1" ondblclick="move(this.form.list1,this.form.list2,1)" size="12" style="width: 149; height:209">
          </select>
          </td>
        <td noWrap vAlign="center">
        <div align="center">
          <br>
          <input name="alluser" onclick="move(this.form.list1,this.form.list2,1)" type="button" value=" → ">
          <br>
          <br>
          <input name="chooseuser" onclick="move(this.form.list2,this.form.list1,2)" type="button" value=" ← ">
          <br>
          <br>
          <input name="up" onclick="Moveup(this.form.list2)" type="button" value=" ↑ ">
          <br>
          <br>
          <input name="down" onclick="Movedown(this.form.list2)" type="button" value=" ↓ ">
          <br>
         </div>
        </td>
        <td>
        <select multiple name="list2" ondblclick="move(this.form.list2,this.form.list1,2)" size="12" style="width: 149; height:209">
        </select></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td  colspan="2" align=center>
    <input name="Submit" onclick="return button5_onclick()" type="button" value="保存">
    <input name="Cancel" onclick="window.close()" type="button" value="取消"></td>
  </tr>
</table>
</form>
</body>
</html>

原文转自:http://www.ltesting.net