create CSS declaration in JavaScript (in IE6)?

S

stephen.cunliffe

Hi all,

Quick question. I know that IE6's support for CSS is well... hmmm...
lets just say not very good, however I was wondering if style
declarations can be added at run time, via JS?

e.g.
Can I create a new rule?

Thanks,
Steve
 
M

Martin Honnen

Quick question. I know that IE6's support for CSS is well... hmmm...
lets just say not very good, however I was wondering if style
declarations can be added at run time, via JS?

e.g.
Can I create a new rule?

Yes, you can, IE supports the document.styleSheets collection and each
sheet object has a method addRule e.g.
styleSheetObject.addRule('selector', 'declarations')
see the MSDN documentation
<http://msdn.microsoft.com/library/d...op/author/dhtml/reference/methods/addrule.asp>
for more details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top