Sun, 2007-03-11 21:37
I have a link that I'd like to assign a new css class style to on mouse click. I tried this, but it doesn't work
People
Notice the code that says 'this.style.class=cur01'. This doesn't do anything. I know the CSS class "cur01" is valid because when I assign the class='cur01' property to the element, it accepts it allright.
Thanks,
-- jenni
Sun, 2007-03-11 22:00
#1
It's because class is not a
It's because class is not a style property. You can do:
this.style.color
this.style.background
this.style.font-size
etc, but not class. I think (not that good on js) that you need this.className=... instead.
Sun, 2007-03-11 23:25
#2
ah, ok. You're right. I had
ah, ok. You're right. I had to use javascript, but it worked just fine.
this.className='cur01';
This did the trick.
Thanks!