最近更新
阅读排行
关注本站

JS中document对象的属性

阅读:5091 次   编辑日期:2014-07-21

目录:

概述:

最近一直在琢磨Java,好久没更新JS,今天咱们说说JS中最常用的操作就是document的操作了,所以从今天开始咱们一起总结一下document的内容。

document对象属性:

    document.title //设置文档标题等价于HTML的title标签
    document.bgColor //设置页面背景色
    document.fgColor //设置前景色(文本颜色)
    document.linkColor //未点击过的链接颜色
    document.alinkColor //激活链接(焦点在此链接上)的颜色
    document.vlinkColor //已点击过的链接颜色
    document.URL //设置URL属性从而在同一窗口打开另一网页
    document.fileCreatedDate //文件建立日期,只读属性
    document.fileModifiedDate //文件修改日期,只读属性
    document.charset //设置字符集 简体中文:gb2312
    document.fileSize //文件大小,只读属性
    document.cookie //设置和读出cookie

document常用对象方法:

    document.write() //动态向页面写入内容
    document.createElement(Tag) //创建一个html标签对象
    document.getElementById(ID) //获得指定ID值的对象
    document.getElementsByName(Name) //获得指定Name值的对象
    document.body.appendChild(oTag)//指定元素节点的最后一个子节点之后添加节点
将本篇文章分享到:
top