บทที่ 10 Document Object
-
JavaScript :: Document Object :: write()
write ( string ); void ใช้เขียนข้อความลงบนเอกสาร window.document.write ( "<b>welcome</b>" );
-
JavaScript :: Document Object :: URL
URL; string, void ใช้กำหนด หรือคืนค่า url ของ web page ที่กำลังเรียกใช้งาน window.document.URL = http://www.bamboolabcode.com;
-
JavaScript :: Document Object :: referrer
referrer; string ใช้คืนค่า URL ของ web page ที่โหลด web page ปัจจุบันขึ้นมา alert ( window.document.referrer );
-
JavaScript :: Document Object :: domain
domain; string ใช้คืนค่า domain ของ web page นี้ alert ( window.document.domain );
-
JavaScript :: Document Object :: cookie
cookie; string, void ใช้กำหนด หรือคืนค่า cookie ที่เกี่ยวข้องกับ web page นี้ alert ( window.document.cookie );
-
JavaScript :: Document Object :: title
title; string, void ใช้กำหนดค่า หรือคืนค่า title ของ web page นี้ window.document.title = "welcome to bamboolabcode";
-
JavaScript :: Document Object :: lastModified
lastModified; string ใช้คืนค่า วันและเวลา ที่ทำการแก้ไขไฟล์ครั้งล่าสุด alert ( window.document.lastModified );
-
JavaScript :: Document Object :: bgColor
bgColor; string ใช้กำหนดค่า หรือคืนค่า สีพื้นหลังของ web page นี้ alert ( window.document.bgColor );
-
JavaScript :: Document Object :: fgColor
fgColor; string ใช้กำหนดค่า หรือคืนค่า สีตัวอักษรของ web page นี้ alert ( window.document.fgColor );
-
JavaScript :: Document Object :: linkColor
linkColor; string ใช้กำหนดค่า หรือคืนค่า สีของ link ที่ยังไม่ถูกคลิก alert ( window.document.linkColor );
-
JavaScript :: Document Object :: vlinkColor
vlinkColor; string, void ใช้กำหนดค่า หรือคืนค่า สีของ link ที่เคยถูกคลิกแล้ว alert ( window.document.vlinkColor );
-
JavaScript :: Document Object :: alinkColor
alinkColor; string, void ใช้กำหนดค่า หรือคืนค่า สีของ link ที่กำลังถูกคลิก alert ( window.document.alinkColor );
-
JavaScript :: Document Object :: body
body; node, body ใช้กำหนดให้ อ้างถึง element body var tagBody = window.document.body; alert ( tagBody.tagName );
-
JavaScript :: Document Object :: embeds
embeds; node array, embed array ใช้กำหนดให้อ้างถึง element embed var tagEmbed = window.document.embeds; alert ( tagEmbed[0].tagName );
-
JavaScript :: Document Object :: forms
forms; node array, form array ใช้กำหนดให้อ้างถึง element form var tagForm = window.document.forms; alert ( tagForm[0].tagName );
-
JavaScript :: Document Object :: images
images; node array, image array ใช้กำหนดให้อ้างถึง element image var tagImage = window.document.images; alert ( tagImage[0].tagName );
-
JavaScript :: Document Object :: links
links; node array, link array ใช้กำหนดให้อ้างถึง element link var tagLink = window.document.links; alert ( tagLink[0].tagName );
-
JavaScript :: Document Object :: styleSheets
styleSheets; node array, style array ใช้กำหนดให้อ้างถึง element style var tagStyle = window.document.styleSheets; alert ( tagStyle[0].tagName );
-
JavaScript :: Document Object :: layers
layers; node array, layer array ใช้กำหนดให้อ้างถึง element layer var tagLayer = window.document.layers; alert ( tagLayer[0].tagName );
-
JavaScript :: Document Object :: documentElement
documentElement; node ใช้กำหนดให้อ้างถึง root ของ node ( คือ element html ) var tagHTML = document.documentElement; alert ( tagHTML.tagName );
-
JavaScript :: Document Object :: getElementById()
getElementById ( string ); node ใช้ในการคืนค่า element ที่มี id ตามที่กำหนด โดยจะเป็นการเข้าถึง element ใด element หนึ่งโดยเฉพาะ var tagDiv = document.getElementById ( "bamboo" ); alert ( tagDiv.tagName );
-
JavaScript :: Document Object :: createElement()
createElement ( tag_name ); node ใช้สร้าง element node ( สร้าง tag คำสั่งของ html ) var tagDiv = document.createElement ( "div" );
บทเรียนทั้งหมด |
|
แหล่งอ้างอิง:
http://www.bamboolabcode.com/javascript/document
แหล่งอ้างอิง
http://www.bamboolabcode.com/javascript/document
เพิ่มให้แล้วครับ ต้องขอโทษแทนเด็กๆ ด้วยครับ
-----------------------------------------------------------------------------------------
ครูพูนศักดิ์ สักกทัตติยกุล
ทำด้วยใจ ไปด้วยฝัน