有一个页面A,A中有一TextField和链接,当点击链接后,弹出一窗口,当在弹出窗口中做完操作(比如说通过下拉列表选择一个值)并关闭该弹出窗口后,需要将弹出窗口中的操作时写回到A页面中的那个TextField中,就有点像通常用的日期控件那个效果,只不过我这要用弹出窗口对JS 不熟悉,不知道怎么做,大家帮忙啊!

解决方案 »

  1.   

    /**
    * 打开一个弹出窗口
    * @param {String} 要打开页面的url
    * @param {String} 新窗口名称
    * @param {String} 新窗口属性,如果为null则使用默认属性
    */
    function openWindow(url,name,property)
    {
    var printtop=(screen.height-600)/2;
    var printleft=(screen.width-500)/2;
    var theproperty;

    if ( property == null )
    theproperty= 'width=600,height=400,center=yes,help=no,status=no,scrollbars=yes,resizable=yes,left='+printleft+',top="'+printtop+',screenx='+printleft+',screeny='+printleft;
    else
    theproperty = property;

    window.open(url,name,theproperty);
    }弹出页面中:
    window.opener.document.XXX.value =XXX;
    window.close();
      

  2.   

    a.html<form name="form">
    <input type="button" value="open" onclick="window.open('b.html')" />
    <span title="dsfsdf">请输入姓名:</span>
    <input type="text" name="name"><br>
    </form>---------b.html<input type=text name=son ><input type=button value=click onclick="closeson()" >
    <script>

    function closeson()
    {
    var a = document.all('son').value ;
    window.opener.form.name.value =  a ;
    window.close();
    }
    </script>