471,887 Members | 942 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

simple onmouseover className change fails

Tarantulus
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. }
  4.  
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 1741
pronerd
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. }
  4.  


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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.