469,333 Members | 4,354 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

simple onmouseover className change fails

114 100+
Hi guys,

I have the following simple function which errors in IE6

Expand|Select|Wrap|Line Numbers
  1. function changecss(id,class){
  2. document.getElementById(id).className = class;
  3. }
and in the HTML I have

Expand|Select|Wrap|Line Numbers
  1. onmouseover="changecss(this.id,'hover');"
I can't see why it's not working, perhaps I can't see the wood for the trees...

can you assist?

Thanks in advance
Oct 21 '08 #1
1 1710
392 Expert 256MB
What is the rest of the HTML for the tag calling that function? Is the ID attribute being set?

To make this simpler I would just pass the elment it self instead of the elements ID attribute.

Expand|Select|Wrap|Line Numbers
  1. function changecss(el,class){
  2.     el.className = class;
  3. }

Expand|Select|Wrap|Line Numbers
  1. onmouseover="changecss(this,'hover');"
Oct 21 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Epetruk | last post: by
3 posts views Thread by Vear | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.