直接上代码,有些地方可以用到:

复制代码 代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT LANGUAGE="JavaScript">
<!--
function selectValue(){
    window.open("sub.html","","status:no;resizable:yes;dialogHeight:410px;dialogWidth:460px;unadorne:yes")
}
//-->
</SCRIPT>
</HEAD>

<BODY>
    text:<input type="text" name="testInput" /><br>
    <input type="button" onclick="selectValue()" value="选择" />
</BODY>
</HTML>

sub.html页面代码是

复制代码 代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT LANGUAGE="JavaScript">
<!--
function selectValues(){
   var obj = document.getElementsByName("temp");
   var value = "";
   for(var i = 0 ;i < obj.length ; i ++){
        if(obj[i].checked == true)
            value += obj[i].value;
   }
   window.opener.document.all.testInput.value = value;
   window.close();
}
//-->
</SCRIPT>
</HEAD>

<BODY>
    <input type="checkbox" name="temp" value="A" />  A <br>
    <input type="checkbox" name="temp" value="B"/>  B <br>
    <input type="checkbox" name="temp" value="C" /> C <br>
    <input type="checkbox" name="temp" value="D" />  D <br>
    <input type="button" value="OK" onclick="selectValues()"/>
</BODY>
</HTML>

标签:
javascript,弹出窗口,返回值

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com