中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

HTML DOM close() 方法

Document 對象參考手冊 Document 對象

定義和用法

close() 方法用于關(guān)閉一個由 document.open 方法打開的輸出流,并顯示選定的數(shù)據(jù)。

語法

document.close()

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 close() 方法


實(shí)例

實(shí)例 1

打開一個輸出流,添加一些文本,然后關(guān)閉輸出流:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<script>
function createDoc(){
????var doc=document.open("text/html","replace");
????var txt="<!DOCTYPE html><html><body>學(xué)習(xí) HTML DOM 很有趣!</body></html>";
????doc.write(txt);
????doc.close();
}
</script>
</head>

<body>
<input type="button" value="新文檔" onclick="createDoc()">
</body>
</html>

運(yùn)行代碼 ?

實(shí)例 2

打開輸出流 (新窗口打開; about:blank),添加文本,然后關(guān)閉輸出流:

<html>
<body>

<script>
var w=window.open();
w.document.open();
w.document.write("<b>Hello World!</b>");
w.document.close();
</script>

</body>
</html>

運(yùn)行代碼 ?

Document 對象參考手冊 Document 對象其他擴(kuò)展