document對象的屬性和方法

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                                           指向子結點結合中的最後一個子結點的引用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章