问题是:这个是javascript而不是JSP,两者有天壤之别。

解决方案 »

  1.   

    if(newWindow.closed){ 
    //这个.closed作者注释为判断窗口是否关闭,可是明显不对,可能手误了,请问应该是什么?
    makeNewWindow()
    }
    这里newWindwo为null,不能写newWindow.closed
      

  2.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>Writeing to Subwindow</title>
    <script language="javascript">
    var newWindow
    function makeNewWindow(){
    newWindow=window.open("","","status,height=200,width=300")
    }
    function subWrite(){ makeNewWindow()
    if(newWindow!=null){
    newWindow.focus();


    var newContent="<html><head><title>A New Dox</title></head>"
    newContent +="<body><h1>This deocument is brand new.</h1>"
    newContent +="Click the Back button to see original document."
    newContent +="</body></html>"
    newWindow.document.write(newContent)
    newWindow.document.close()
    }else alert("打开失败!");
    }
    </script>
    </head><body onLoad="makeNewWindow()">
    <form>
    <input type="button" value="write to subwindow" onClick="subWrite()">
    </form>
    </body>
    </html>