document.open()方法打开一个新的文档,并用document.write()方法编写文档的内容,然后用document.close()方法关闭文档操作,使其内容显示出来。
例如:
<script type="text/<a style=" color: text-decoration:underline title="javascript" href="https://www.php.cn/zt/15724.html" target="_blank">javascript"> <br>window.onload=hello; <br>function hello(){ <br>var msg = "JavaScript真好玩!"; <br>document.open(); <br>document.write(msg); <br>document.close(); <br>} <br></script>











