Latest web development tutorials
×

JavaScript & HTML DOM リファレンスマニュアル

概要

JavaScript オブジェクト

JavaScript Array オブジェクト JavaScript Boolean オブジェクト JavaScript Date オブジェクト JavaScript Math オブジェクト JavaScript Number オブジェクト JavaScript String オブジェクト JavaScript RegExp オブジェクト JavaScript グローバルプロパティ/関数 JavaScript 演算子

Browser オブジェクト

Window オブジェクト Navigator オブジェクト Screen オブジェクト History オブジェクト Location オブジェクト

DOM オブジェクト

HTML DOM Document オブジェクト HTML DOM Elementオブジェクト HTML DOM 属性オブジェクト HTML DOM イベントオブジェクト

HTML オブジェクト

<a> <area> <audio> <base> <blockquote> <body> <button> <canvas> <col> <colgroup> <datalist> <del> <details> <dialog> <embed> <fieldset> <form> <iframe> <frameset > <img> <ins> <input> - button <input> - checkbox <input> - color <input> - date <input> - datetime <input> - datetime-local <input> - email <input> - file <input> - hidden <input> - image <input> - month <input> - number <input> - range <input> - password <input> - radio <input> - reset <input> - search <input> - submit <input> - text <input> - time <input> - url <input> - week <keygen> <link> <label> <legend> <li> <map> <menu> <menuItem> <meta> <meter> <object> <ol> <optgroup> <option> <param> <progress> <q> <script> <select> <source> <style> <table> <td> <th> <tr> <textarea> <title> <time> <track> <video>

HTML DOMのclose()メソッド

ドキュメント・オブジェクト・リファレンス ドキュメントオブジェクト

定義と使用法

close()メソッドは、ブラウザウィンドウを閉じるために使用されます。

文法

document.close()


ブラウザのサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要なブラウザでは、close()メソッドをサポート


例1

、出力ストリームを開き、いくつかのテキストを追加し、出力ストリームを閉じます。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function createDoc(){
    var doc=document.open("text/html","replace");
    var txt="<!DOCTYPE html><html><body>学习 HTML DOM 很有趣!</body></html>";
    doc.write(txt);
    doc.close();
}
</script>
</head>

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

»をお試しください

例2

出力ストリームを開きます(新しいウィンドウが開きます;約:空白)、テキストを追加し、出力ストリームを閉じます。

<html>
<body>

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

</body>
</html>

»をお試しください


ドキュメント・オブジェクト・リファレンス ドキュメントオブジェクト