这么说,这个close函数就基本没什么用处了?大家平时是不是都不用它?

解决方案 »

  1.   

    <head>
    <title>Insert title here</title>
    <script type="text/javascript">
    function output(){
    document.write("<B>HelloWorld!</B>");
    document.close();    //key area!
    document.write("<B>HelloWorld222!</B>");
    }
    </script>
    </head>
    <body><input type="button" value="O" id="btnOpen" name="btnOpen" onclick="output()"></body>
      

  2.   

    close对于document来说是不需要的..
    close只是对于你一些判断来说..如果某个条件不符合你的要求,就用close,后面的document.write就无效了。
      

  3.   

    楼上的你的最后句话错了,you can try.
    close只是关闭当前的write,之后的write 是刷新后再显示。
      

  4.   

    You should not use the write or writeln methods on the current document after the document has finished loading unless you first call the open method, which clears the current document's window and erases all variables.Note  When document.write or document.writeln is used in an event handler, document.close should also be used.