用window.open打开一个有form的页面,再通过opener将form中控件的value写回原窗口

解决方案 »

  1.   

    用window.open(...)弹出窗口或者模态窗口都可以。1.htm
    <script language="javascript">
    <!--
    function showDialog(nvCompanyName)
    {
    var RetVal =null;
    RetVal = showModalDialog("2.htm");
    if (RetVal!=null)
    {
    document.form.txt.value =RetVal;
    }

    }
    //-->
    </script>
    <form name=form>
    <input type=text name=txt>
    <input type=button value=点我 onclick="showDialog(document.form.txt.value)">
    </form>2.htm<input type=text name=txt>
    <INPUT TYPE="BUTTON" VALUE="Select" onClick="returnValue=txt.value;self.close();">
      

  2.   

    用var a=showModalDialog(url,参数)弹出摸太对话框,用returnvalue返回值,a接受
      

  3.   

    a1.htm<input type=hidden name=text1>
    <input type=hidden name=text2>
    <input type=hidden name=combo1>
    <button onclick="openwin();">open win</button>
    <script>
     function openwin(){
      window.showModalDialog("a2.htm","","dialogHeight: 504px; dialogWidth: 366px; dialogTop: 100px; dialogLeft: 100px; edge: Sunken; center: Yes; help: Yes; resizable: Yes; status: Yes;");

    </script>a2.htm
    <title>对话框名字</title><input type=text name=text1>
    <input type=text name=text2>
    <select name=combo1><option value=1>1</option></select><button onclick="returnvalue();"> o k </button>
    <script>
      function returnvalue(){
        var pd=parent.document.all;
        var ld=document.all;
        pd.text1.value=ld.text1.value;
        pd.text2.value=ld.text2.value
        pd.combo1.value=ld.combo1.value
    }
    </script>
    直接写的,没有调试,可能有错误,不过大概就是这个意思,你试试看吧
      

  4.   


    function dobg(o,type){
    var fcolor=showModalDialog("backGroundSelect.aspx?type="+type,false,"dialogWidth:308px;dialogHeight:310px;status:0;");
    if(fcolor!=undefined){
    eval(o).value=fcolor;
    }
    }