例如,在a.html文件中,用document.write写的东西后,用哪个函数可以把页面清空,变成空白页?

解决方案 »

  1.   

    document.open()
    document.write("start")
      

  2.   

    document.body.innerHTML = "";
      

  3.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title></title>
    </head>
    <body><button onclick="fun1()">open</button>
    <button onclick="fun2()">close</button>
    <button onclick="fun3()">innerHTML</button>
    <button onclick="fun4()">reload</button><SCRIPT LANGUAGE="JavaScript">
    <!--
    function fun1()
    {
    document.write("afgsdfgsd<br>")
    document.open()
    }
    function fun2()
    {
    document.write("afgsdfgsd<br>")
    document.close()
    }
    function fun3()
    {
    document.write("afgsdfgsd<br>")
    document.body.innerHTML="";
    }
    function fun4()
    {
    document.write("afgsdfgsd<br>")
    location.reload()
    }
    //-->
    </SCRIPT>
    </body>
    </html>