这个是子窗口的代码,可是这个代码,只能刷新父窗口中的几个参数的直,我想要重新建一个表格,输出这几个直。该怎么样阿。
                      <input type="button" name="return" value="return" onclick="doRet()">
<script language="JavaScript">
function doRet()  
{   
             window.opener.document.getElementById("oskey").value = oskey.value;
             window.opener.document.getElementById("camip").value = camip.value;
             window.opener.document.getElementById("fwport").value= fwport.value;
             window.close();
             }
</script>
父窗口中只有window.open().
有没有高书能指点下阿?
在线等!!!!!!!!!!!

解决方案 »

  1.   

    假设你在你窗口中有一个<div id="div1">,
    请原谅我偷懒了。function doRet(){
        var str = "<html border='1'>";
        str += "<tr>";
        str += "<td>" + oskey.value; + "</td>";
        str += "<td>" + camip.value; + "</td>";
        str += "<td>" + fwport.value; + "</td>";
        str += "</tr>";
        str += "</table>";    window.opener.document.getElementById("div1").innerHTML = str;
    }
      

  2.   

    唉! 敲错了.
    基本思想是这样的.function doRet(){
        var str = "<table border='1'>";
        str += "<tr>";
        str += "<td>" + oskey.value;
        +"</td>";
        str += "<td>" + camip.value;
        +"</td>";
        str += "<td>" + fwport.value;
        +"</td>";
        str += "</tr>";
        str += "</table>";
        window.opener.document.getElementById("div1").innerHTML = str;
    }
      

  3.   

    谢谢楼上的。
    这个div是在父窗口中还是在自窗口中阿
    本人是新手!!!谢谢了 !!
      

  4.   


    //w1.html
    <input type="button" name="return" value="return" onclick="doRet()"> <script language="JavaScript"> 
    function doRet()  
    {  
        var sarray = new Array();
            sarray.push("test1");
            sarray.push("test2");
            if(window.opener.callback)
            window.opener.callback( sarray );
        alert("暂停,准备进行下一个测试");
        var strTbl  = "<table border='1'>";
                strTbl += "    <tr>";
                strTbl += "        <td>win_test_1</td>";
                strTbl += "    </tr>";
                strTbl += "    <tr>";
                strTbl += "        <td>win_test_2</td>";
                strTbl += "    </tr>";
                strTbl += "</table>";
         window.opener.document.body.innerHTML = strTbl;

    </script> //p1.html<body>
    123
    </body>
    <script>var callback = function(code)
    {
        if( typeof( code ) == "object" && code.length == 2)
        {
            var strTbl  = "<table border='1'>";
                strTbl += "    <tr>";
                strTbl += "        <td>"+code[0]+"</td>";
                strTbl += "    </tr>";
                strTbl += "    <tr>";
                strTbl += "        <td>"+code[1]+"</td>";
                strTbl += "    </tr>";
                strTbl += "</table>";
            document.body.innerHTML = strTbl;
        }
        else
            alert(typeof(code) );
    }
    window.open( "w1.html","200","200","200","300" );
    </script>
      

  5.   

    我说看着代码这么眼熟呢.
    我昨天给你回去那个帖子里有创建表的代码呀!!!
    你别告诉我你没看呀!!!!http://topic.csdn.net/u/20081124/03/5e6134dc-5482-4cf9-966f-65653b8cc5bf.html
      

  6.   

     </head>
        <script language="JavaScript">
            function doRet(){
                var retVal = {};
                retVal.x = document.getElementById("x").value;
                retVal.y = document.getElementById("y").value;
                retVal.z = document.getElementById("z").value;
                returnValue = retVal;
                close();
            }
        </script>
        <body>
    就是这段,点了按钮,没有任何反应,窗口也管不了,