<SCRIPT language="javascript">
//Esc键退出
function document.onkeydown()
{
var k = window.event.keyCode;
if(k==27)
window.close();
}
</SCRIPT>
<script language="JavaScript">
function PostValue()
{
var lbobject=document.all.Lb_Object;
var revalue=new Array();
var k=-1;
for(i=0;i<lbobject.options.length;i++)
{
revalue[++k] = lbobject.options[i].text;
revalue[++k] = lbobject.options[i].value;
}
window.parent.returnValue = revalue;
window.close();
return;
}
//移动选中项目
function MoveSingleItem(sel_source, sel_dest)
{
if (sel_source.selectedIndex<0)return; //源:没有点选任何项目
var str="";
var sel_source_len = sel_source.length;
for(var i=0;i<sel_source_len;i++)
{
if(sel_source.options[i].selected)
{
var oOption = document.createElement("OPTION");
oOption.text=sel_source.options[i].text;
oOption.value=sel_source.options[i].value;
sel_dest.options.add(oOption);
//这里很关键
sel_source.options.remove(i);
sel_source_len--;
i=-1;
}
}
CopyToControl();
}
//设置选中项目
function MoveAllItems(sel_source, sel_dest)
{
var sel_source_len = sel_source.length;
//先复制“源”所有项目:
for (var j=0; j<sel_source_len; j++)
{
var oOption = document.createElement("OPTION");
oOption.text=sel_source.options[j].text;
oOption.value=sel_source.options[j].value;
sel_dest.options.add(oOption);
}
//然后删除“源”所有项目:
for (var k=0;k<sel_source_len;k++)
{
sel_source.options.remove(0);
}
CopyToControl();
}
function CopyToControl(){ //复制到其他控件
var sControl=document.all.txt_ObjectUser;
sControl.value="";
for(var i=0;i<document.all.Lb_Object.length;i++){ //拷贝数据
sControl.value=sControl.value+document.all.Lb_Object.options[i].value+',';
}
}
function SelectAll(theSel) //选中select中全部项目
{
for (i = 0 ;i<theSel.length;i++)
theSel.options[i].selected = true;
}
var PageLoadFlag=false;
//页面加载
function On_PageLoad(){
if(PageLoadFlag)return;
PageLoadFlag=true;
<%//如果是第一次则列出原来用户
if(!isInitLb_Object){
Response.Write("InitLb_Object(parent.dialogArguments);");
}
%>
var theSel=document.all["Ddl_Org"];
var re=/\&/;
//替换字符串
if(theSel!=null){
for(i=0;i<theSel.length;i++){
do{
var sTem=theSel.options[i].innerHTML;
theSel.options[i].innerHTML = theSel.options[i].innerHTML.replace("&","&");
}while(sTem!=theSel.options[i].innerHTML)
}
}
}
function InitLb_Object(value){
document.all.Txt_Sel.value=value;
if(value.length>36)
window.Form1.submit();
}