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 วัตถุธาตุ 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 ใกล้ () วิธีการ

อ้างอิงวัตถุเอกสาร วัตถุเอกสาร

ความหมายและการใช้งาน

ใกล้ () วิธีการที่ใช้ในการปิดหน้าต่างเบราว์เซอร์

ไวยากรณ์

document.close()


สนับสนุนเบราว์เซอร์

Internet ExplorerFirefoxOperaGoogle ChromeSafari

เบราว์เซอร์ที่สำคัญทุกการสนับสนุนอย่างใกล้ชิด () วิธีการ


ตัวอย่าง

ตัวอย่างที่ 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>

ลอง»


อ้างอิงวัตถุเอกสาร วัตถุเอกสาร