您的位置:首页 > 其它

document对象的属性和方法

2011-07-05 11:00 387 查看
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 指向子结点结合中的最后一个子结点的引用
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: