百度空间 | 百度首页 
               
 
查看文章
 
document.styleSheets对象集合介绍
2008-01-21 12:29 P.M.

Document.styleSheets Info

Document.styleSheets:
一组关联于文档的样式表片段集合.
Document.styleSheet:
一个关联于文档的样式表片段对象.
/**
* 得到 styleSheets:方法
* @return Array of styleSheet
*/
function getDocStyleSheets(){
var doc_styleSheets=document.styleSheets;
return doc_styleSheets;
}
var css01=getDocStyleSheets()[0];//得到文档中关联的第一个stylesheet片段对象.
/*
stylesheet对象
对于Firefox公开的对象:
type
disabled
ownerNode
parentStyleSheet
href
title
media
ownerRule
cssRules
insertRule
deleteRule
_____________________________________________
stylesheet对象
对于IE公开的对象:
owningElement
pages
id
type
href
disabled
cssText
readOnly
title
parentStyleSheet
imports
rules
media
兼容IE&FireFox的对象:
disabled --> 是否启用此css定义片段
e g.
css01.disabled=true;
这时当前文档讲忽略css01的css定义

rules-->css定义集合[IE专有],可读写
cssRules-->css定义规则集合[Firefox专有]可读写
e g.
var css01_Rules=css01.rules||css01.cssRules;
css01_Rules.style.fontSize='12px';
这时候将改变css定义中body{
font-size:14px;
}
页面所有文字大小讲改变。
*/
这种应用可以应用在对于页面大量dom元素的渲染操作。非常节省客户端资源。免除了遍历DOM节点。免除了给每个dom节点设置特定的id或className
著名js框架mootools对document.styleSheets的应用:
http://demos.mootools.net/Fx.Morph

类别:Ajax | 添加到搜藏 | 浏览() | 评论 (6)
 
网友评论:
1
2008-01-23 12:49 P.M. | 回复
最上面是javascript?
 
2
2008-01-25 01:16 P.M. | 回复
路过
 
3
2008-02-09 08:45 P.M. | 回复
茶走留香给你拜个年◢█◣爆竹声声除旧岁!         ◢◤ ◥◣        ◢◤   ◥◣       ◢◤天天新世界◥◣      ◢◤ █▆▆▆█ ◥◣     ◢◤  █▆▆▆█  ◥◣    ◢◤ ◥◣█▆▆▆█◢◤ ◥◣    ◥◣ ▇▇▇▇▇▇▇▇▇ ◢◤     ◥◣ ▆▆▆█▆▆▆ ◢◤      ◥◣ ▆▆█▆▆ ◢◤       ◥◣  █  ◢◤        ◥◣   ◢◤         ◥◣ ◢◤          ◥█◤        ◢█◤//        ◢█◤ //◢◣      ╭◥◤  //◥█◣         ◢◣// ◥█◣        ◢█◤//  ◥◤╮       ◢█◤ //◢◣      ╭◥◤  //◥█◣         ◢◣// ◥█◣        ◢█◤//  ◥◤╮       ◢█◤ //◢◣      ╭◥◤  //◥█◣         ◢◣// ◥█◣  ☆     ◢█◤//。?◥◤╮★   ╲ o‘◢█◤ //◢◣╲(╱?   ‘╲(╱◤  //◥█(☆)  。 (★)‘ ╲(╱o╱)╲。
 
4
2008-02-09 10:15 P.M. | 回复
★*2008*★ ★★ ☆☆ ★★ * ★  ∴*★ *  ∴°★ ★  ☆°∴★*  *°★ ★°Happy New Year!*°★  ★' ☆☆ *°∴°°☆☆★ *°☆☆   ★ °∴°°☆°∴★*°☆∴新°∴*☆    ★*°∴°°☆★∴°∴*°年°∴*°☆     ★°∴★☆∴°∴*快°∴*°☆      ★  ☆∴*樂°∴°☆       ﹨  ☆*  ☆        ﹨   ☆         ﹨ /          ﹨/           ▏● ┬┴┬┌─ ●─┬─  │─┼─┐ ●├─┤○ ┴┬┴├┬ ┌─┼─ │◎ │ │ ○└┬┘● ─┼─││ │ │  ││─┴─┴ ──┼── ●│○││ ┴─┼─  │○  ● / │ \ f0s8 祝你鼠年春节好运来! http://fu.cc139.com/023/jieri/chunjie.html?id=f0s8
 
5
2008-02-22 06:15 P.M. | 回复
我咋看不懂!
 
6
2009-03-02 06:17 P.M. | 回复
www.2shoushu.com
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu