1. 程式人生 > >JavaScript document open() 方法:打開一個新文檔

JavaScript document open() 方法:打開一個新文檔

打開 click 寫入 ack create tex scrip ava pan

<html>
<head>
<script type="text/javascript">
function createNewDoc()
{
    var new_doc = document.open("text/html","replace");
    var txt = "<html><body>這是新的文檔</body></html>";
    new_doc.write(txt);
    new_doc.close();
}
</script>
</head>
<body
> <button onclick="createNewDoc()">點擊寫入新文檔</button> </body> </html>

JavaScript document open() 方法:打開一個新文檔