PDA

View Full Version : change dynamicaly className in NS


hryan
12-10-2002, 03:54 PM
How can I change dynamicaly className in NS?
In IE I do this in this way:

document.userform.id['f'].className='a';
or
f.className='a';

This changes current classname to class named 'a'.

But this don't work in NS! In fact I even can not acces in this way to id.
I will be appreciated of any suggestions or help

Vladdy
12-10-2002, 04:15 PM
which NS are you talking about? 4.x or 6+?
For 6+ use DOM compliant coding:
document.getElementById('MyElement').className = 'MyElementClass';

hryan
12-11-2002, 09:28 AM
Great thanks!

Is there solution for NS 4.x too?