document物件的屬性和方法
activeElement = [object]
alinkColor = #0000ff
all = [object]
anchors = [object]
applets = [object]
attributes = null
bgColor = #336699
body = [object]
childNodes = [object]
compatMode = BackCompat
cookie = style=null
defaultCharset = gb2312
dir =
doctype = null
documentElement = [object]
domain =
embeds = [object]
fgColor = #000000
fileCreatedDate = 07/04/2003
fileModifiedDate = 07/07/2003
fileSize = 5514
fileUpdatedDate =
firstChild = [object]
forms = [object]
frames = [object]
images = [object]
implementation = [object]
lastChild = [object]
lastModified = 07/07/2003 10:38:04
linkColor = #0000ff
links = [object]
location = file:///E:/文章/網頁物件.htm
media =
mimeType = HTML Document
nameProp = 物件屬性顯示器
namespaces = [object]
nextSibling = null
nodeName = #document
nodeType = 9
nodeValue = null
onactivate = null
onafterupdate = null
onbeforeactivate = null
onbeforedeactivate = null
onbeforeeditfocus = null
onbeforeupdate = null
oncellchange = null
onclick = null
oncontextmenu = null
oncontrolselect = null
ondataavailable = null
ondatasetchanged = null
ondatasetcomplete = null
ondblclick = null
ondeactivate = null
ondragstart = null
onerrorupdate = null
onfocusin = null
onfocusout = null
onhelp = null
onkeydown = null
onkeypress = null
onkeyup = null
onmousedown = null
onmousemove = null
onmouseout = null
onmouseover = null
onmouseup = null
onmousewheel = null
onpropertychange = null
onreadystatechange = null
onrowenter = null
onrowexit = null
onrowsdelete = null
onrowsinserted = null
onselectionchange = null
onselectstart = null
onstop = null
ownerDocument = null
parentNode = null
parentWindow = [object]
plugins = [object]
previousSibling = null
protocol = File Protocol
readyState = complete
referrer =
scripts = [object]
security = 這種型別的文件沒有安全證書。
selection = [object]
styleSheets = [object]
title = 物件屬性顯示器
URL = file://E:/文章/網頁物件.htm
URLUnencoded = file://E:/文章/網頁物件.htm
vlinkColor = #800080
document方法:
open( )
close( )
clear( )
write( )
writeln( )
getElementById(id) 返回指定元素的引用
getElementsByName(elementName) 返回name="elementName"的所有XHTML元素物件的列表
getElementsByTagName(name) 返回文件中所有匹配的元素的集合
createComment(data) 建立XHTML註釋<!--data-->
createElement(name) 建立指定型別的新元素
createTextNode(text) 建立一個純文字結點
element方法:
getAttribute(id) 返回指定屬性的值
setAttribute(id,value) 給屬性賦值
removeAttribute(id) 移除指定屬性和它的值
getElementsByTagName(name) 返回結點內所有匹配的元素的集合
node方法:
appendChild(child) 給指定結點新增一個新的子結點
removeChild(child) 移除指定結點的子結點
replaceChild(newChild,oldChild) 替換指定結點的子結點
insertBefore(newChild,refChild) 在同一層級的結點前面插入新結點
hasChildNodes() 如果結點有子結點則返回true
node屬性:
nodeName 以字串的格式存放結點的名稱
nodeType 以整型資料格式存放結點的型別
nodeValue 以可用的格式存放結點的值
parentNode 指向結點的父結點的引用
childNodes 指向子結點的引用的集合
firstChild 指向子結點結合中的第一個子結點的引用
lastChild 指向子結點結合中的最後一個子結點的引用