详细内容
打开新窗口添加项,原窗口处于不活动状态
发布日期:2010-07-15     点击:2723     字体:[ ]

参考以下代码,原页面主要代码:

function openNew()
{
var lstBox=document.getElementById("lstBox");
var hfid=document.getElementById("hfid");
var str="";
var result=window.showModalDialog("memberList.aspx","","dialogHeight=300px;dialogWidth=510px;scroll:auto");
for(var i=0;i<result.length;i++)
{
lstBox.options[lstBox.options.length]=new Option(result[i],result[i]);
if(str == "")
{str=result[i];}
else
{str+=","+result[i];}
}//end for
hfid.value=str;

}//end openNew()

function delItem()
{
var lstBox=document.getElementById("lstBox");

for(var i=lstBox.length - 1;i>=0;i--)
{
if(lstBox.options[i].selected)
{
lstBox.options[i]=null;
}

}//end for

}//end delItem()

function resetItem()
{
var lstBox=document.getElementById("lstBox");
var hfid=document.getElementById("hfid");
var valArray;
valArray=hfid.value.split(",");
lstBox.length=0;

for(var i=0;i<valArray.length;i++)
{
lstBox.options[lstBox.options.length]=new Option(valArray[i],valArray[i]);

}//end for


}//end resetItem()

打开窗口主要代码:

function returnVal()
{
var valArray=[];
var chkItem=document.form1.chkItem;
var chkFlag=false;
for(var i=0;i<chkItem.length;i++)
{
if(chkItem[i].checked == true)
{
chkFlag=true;
valArray[i]=chkItem[i].value;
}//end if
}//end for

if(!chkFlag)
{alert("没有选择任何项目。。。。");
return;
}

window.returnValue=valArray;
window.close();

}//end returnVal()

function selectOrNot()
{
var chkAll=document.getElementById("chkAll");
var chkItem=document.form1.chkItem;
var isChecked=chkAll.checked;

for(var i=0;i<chkItem.length;i++)
{
chkItem[i].checked=isChecked;

}
}//end selectOrNot()

用户评论
昵称 
内容  *
验证码   
   
Copyright © 2010 zdbase.com All Rights Reserved. 苏ICP备15039389号 可人软件设计