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

simple onmouseover className change fails

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. }
and in the HTML I have

Expand|Select|Wrap|Line Numbers
  1. onmouseover="changecss(,'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. }

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.