Connecting Tech Pros Worldwide Forums | Help | Site Map

onmouseover change css class

Member
 
Join Date: Jan 2008
Posts: 121
#1: Aug 26 '08
Hi,

What i want to do is when i mouseover an image it changes the class of a div that is somewhere on the page.

I thought i could do this by doing:

[HTML]
<div class="header_image2" name="remote" id="remote">
<div id="header_image2_inner">
<img src="images/composite-decking-sm.JPG" height="75" hspace="2" border="0" onmouseover="remote.className = 'composite1';" onmouseout="remote.className = 'header_image2';"/>
</div>
</div>
[/HTML]

But this does not work, any ideas?

Cheers,
Adam

gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,136
#2: Aug 26 '08

re: onmouseover change css class


try:

Expand|Select|Wrap|Line Numbers
  1. onmouseover="document.getElementById('remote').className = 'composite1';"
kind regards
Reply