JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

16.6 Scripting Stylesheets

16.6 Scripting Stylesheets

So far, we’ve seen how to set and query the CSS styles and classes of individual elements. It is also possible to script CSS stylesheets themselves. This is not commonly done, but it can occasionally be useful and this section sketches out the technique.

When scripting stylesheets, there are two kinds of objects you may need to work with. The first kind are the Element objects that representandelements that contain or reference your stylesheets. These are regular document elements and if you give them id attributes, you can select them with document.getElementById(). The second kind of object is a CSSStyleSheet object that represents the stylesheet itself. The document.styleSheets property is a read-only array-like object containing CSSStyle-Sheet objects that represent the stylesheets associated with the document. If you set the title attribute of theorelement that defines or references the style-sheet, that title will be available as the title property of the corresponding CSSStyle-Sheet object.

The subsections that follow explain what you can do with these style and link elements and stylesheet objects.

友情链接It题库(| 版权归yishouce.com所有| 友链等可联系|粤ICP备16001685号-1