By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 3,231 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

simple onmouseover className change fails

Tarantulus
100+
P: 114
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
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 392
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.