...

View Full Version : What do the Script, and Styles array mean in microsoft?



SpiritualStorms
07-07-2004, 02:00 PM
I was just skimming over again this one book, and as i was looking at the DOM picture, i noticed that in addition to the images, links, and anchor arrays, there's 2 other arrays by the names of Scripts, and Styles. How are they used?

Secondly, whats the difference between body, and all? I mean one is an array, hence its all[], but how does it differe specifically from body? Is body only referring to the body tag of a document, while all can refer to all the tags of a file?

Mr J
07-07-2004, 09:31 PM
In short, just about every element in a document is represented in a zero-based collection so a tag such as the P tag can be referenced using

document.getElementsByTagName("P").length

this will give a total of how many <P> tags are in the page.

The script and style arrays work in the same manner although the script one I have yet to see being used.

For the style array you would use

document.styleSheets.length

and then reference the rule of whichever style sheet

document.styleSheets[0].rules[0].style.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum