欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

HTML DOM open() 方法

定義和用法

open() 方法可打開一個(gè)新文檔,并擦除當(dāng)前文檔的內(nèi)容。

語法

document.open(mimetype,replace)
參數(shù) 描述
mimetype 可選。規(guī)定正在寫的文檔的類型。默認(rèn)值是 "text/html"。
replace 可選。當(dāng)此參數(shù)設(shè)置后,可引起新文檔從父文檔繼承歷史條目。

說明

該方法將擦除當(dāng)前 HTML 文檔的內(nèi)容,開始一個(gè)新的文檔,新文檔用 write() 方法或 writeln() 方法編寫。

提示和注釋

重要事項(xiàng):調(diào)用 open() 方法打開一個(gè)新文檔并且用 write() 方法設(shè)置文檔內(nèi)容后,必須記住用 close 方法關(guān)閉文檔,并迫使其內(nèi)容顯示出來。

注釋:屬于被覆蓋的文檔的一部分的腳本或事件句柄不能調(diào)用該方法,因?yàn)槟_本或事件句柄自身也會(huì)被覆蓋。

實(shí)例

<html>
<head>
<script type="text/javascript">
function createNewDoc()
  {
  var newDoc=document.open("text/html","replace");
  var txt="<html><body>Learning about the DOM is FUN!</body></html>";
  newDoc.write(txt);
  newDoc.close();
  }
</script>
</head>
<body>

<input type="button" value="Write to a new document"
onclick="createNewDoc()">

</body>
</html>