JavaScript DOM对象Close()方法示例
在下面的示例中,当我们单击按钮时,将在新页面中显示一条消息。
<html> <head> <script type="text/javascript"> function myfun() { var mm = window.open(); mm.document.open(); mm.document.write("<h2>新页面</h2>"); mm.document.close(); } </script> </head> <body style="background-color: Yellow"> <button onclick="myfun()"> 点击</button> </body> </html>
DOM对象Close()方法语法
document.close()
JavaScript DOM对象Close()方法
JavaScript Close()方法用于关闭当前页面,并使用Document.Open()方法显示输出。
它将显示新页面的结果。
日期:2020-04-11 23:04:36 来源:oir作者:oir