467,910 Members | 1,740 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Manipulating CSS

Hi!

Just as I can manipulate DOM node with JavaScript - can I manipulate the
CSS classes?

CSS:

#myid
{
blah: 123;
}

Pseudo-JS:

myid.blah=321;
....and automatically, all tags with ID=myid will change.

Is this possible?
Jul 20 '05 #1
  • viewed: 3061
Share:
2 Replies
/Timo Nentwig/:
Just as I can manipulate DOM node with JavaScript - can I manipulate the
CSS classes?


Take a look at the W3C's "DOM Level 2 Style" spec:

http://www.w3.org/TR/DOM-Level-2-Style/

There are two distinct chapters:

"Document Object Model Style Sheets"
http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html

"Document Object Model CSS"
http://www.w3.org/TR/DOM-Level-2-Style/css.html

where the first introduces some base interfaces used for any type of
style sheet and the second deals with CSS specifics.

.... and then probably you'll need to post to a scripting related group.

--
Stanimir
Jul 20 '05 #2
Timo Nentwig wrote:
Just as I can manipulate DOM node with JavaScript - can I manipulate the
CSS classes?

CSS:

#myid
{
blah: 123;
}

Pseudo-JS:

myid.blah=321;

...and automatically, all tags with ID=myid will change.

Is this possible?


For DOM-compliant clients:

Document Object Model (DOM) Level 2 Style Specification
http://www.w3.org/TR/DOM-Level-2-Style/
For IE:

styleSheet Object
http://msdn.microsoft.com/workshop/a...stylesheet.asp

rule Object
http://msdn.microsoft.com/workshop/a...jects/rule.asp

style Object
http://msdn.microsoft.com/workshop/a.../obj_style.asp

--
Steve

Each snowflake in an avalanche pleads not guilty. -Stanislaw J. Lec
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Michael J. Astrauskas | last post: by
12 posts views Thread by agent349 | last post: by
1 post views Thread by Barb Alderton | last post: by
reply views Thread by Yohancef Chin | last post: by
1 post views Thread by Donal McWeeney | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.