By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

Manipulating CSS

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
/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

P: n/a
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.