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                                           指向子结点结合中的最后一个子结点的引用

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值