popSelect.js
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:
电子政务应用
开发平台:
Java
- function addList( sList )
- {
- var cVal, oSel;
- cVal = document.forms[0].tempHidden;
- oSel = sList;
- var updated = document.forms[0].updated.value;
- if (updated == "false")
- {
- popup( "/vnex/util/PersonDlg.jsp" );
- return true;
- }
- if( cVal.value != "" )
- {
- var arrVal = cVal.value.split("!!");
- for(var i=0; i < arrVal.length; i++ )
- {
- var arrItems = arrVal[i].split("^^");
- var j = sList.options.length - 1;
- for (; j >= 0; j-- )
- {
- if ( arrItems[1] == sList.item(j).value )
- {
- break;
- }
- }
- if ( j < 0 )
- {
- var newOpt = new Option( arrItems[0], arrItems[1] );
- oSel.options[oSel.options.length] = newOpt;
- }
- }
- }
- document.forms[0].updated.value = "false";
- document.forms[0].tempHidden.value = "";
- return true;
- }
- function popup( URL1 )
- {
- var url2 = "";
- window.open(URL1,"subWin","height=400,width=500,resizable=no,status=no,scrollbars=yes,toolbar=no,menubar=no,location=no");
- }
- function remove()
- {
- myform = document.forms[0];
- myindex = -1;
- for ( i = myform.selectedIDList.options.length - 1; i > myindex; i--)
- {
- if ( myform.selectedIDList.options(i).selected == true)
- {
- myform.selectedIDList.remove(i);
- }
- }
- }
- function remove1( sList )
- {
- //myform = document.forms[0];
- myindex = -1;
- for ( i = sList.options.length - 1; i > myindex; i--)
- {
- if ( sList.options(i).selected == true)
- {
- sList.remove(i);
- }
- }
- }
- function deleteCRM( )
- {
- if ( document.forms[0].selectedIDList.type )
- {
- if( confirm( "确定要删除" ) )
- {
- return true;
- }
- return false;
- }
- }
- function addList2( sList )
- {
- var cVal, oSel;
- cVal = document.forms[0].tempHidden;
- oSel = sList;
- var updated = document.forms[0].updated.value;
- if (updated == "false")
- {
- popup( "/vnex/util/PersonDlg2.jsp" );
- return true;
- }
- var arrVal = cVal.value.split("!!");
- for(var i=0; i < arrVal.length; i++ )
- {
- var arrItems = arrVal[i].split("^^");
- var j = sList.options.length - 1;
- for (; j >= 0; j-- )
- {
- if ( arrItems[1] == sList.item(j).value )
- {
- break;
- }
- }
- if ( j < 0 )
- {
- var newOpt = new Option( arrItems[0], arrItems[1] );
- oSel.options[oSel.options.length] = newOpt;
- }
- }
- document.forms[0].updated.value = "false";
- document.forms[0].tempHidden.value = "";
- return true;
- }
- function addGroupList( sList )
- {
- var cVal, oSel;
- cVal = document.forms[0].tempHidden;
- oSel = sList;
- var updated = document.forms[0].updated.value;
- if (updated == "false")
- {
- popup( "/vnex/util/personGroupDlg.jsp" );
- return true;
- }
- var arrVal = cVal.value.split("!!");
- for(var i=0; i < arrVal.length; i++ )
- {
- var arrItems = arrVal[i].split("^^");
- var j = sList.options.length - 1;
- for (; j >= 0; j-- )
- {
- if ( arrItems[1] == sList.item(j).value )
- {
- break;
- }
- }
- if ( j < 0 )
- {
- var newOpt = new Option( arrItems[0], arrItems[1] );
- oSel.options[oSel.options.length] = newOpt;
- }
- }
- document.forms[0].updated.value = "false";
- document.forms[0].tempHidden.value = "";
- return true;
- }
- //format a string to fixed length
- function fixStrLen( str, lenLim )
- {
- var curLen = str.length;
- var reqSp = lenLim - curLen;
- var resStr = "";
- if ( reqSp > 0 )
- {
- resStr = str;
- for( var i = 0; i < reqSp; i++ )
- {
- resStr += " ";
- }
- }
- else
- {
- resStr = str.substr(0,lenLim);
- }
- return resStr;
- }