PDA

View Full Version : please help. Change bg/txt color onmouseover of more than one div/span tag



emeri
Jul 7th, 2009, 05:41 PM
<div id="column1">
the Belfry<br />
<br />
<span id='retail'>
The Shops at Waterloo Town Square<br />
<br />
</span>
JBU/Just Between Us<br />
<br />
<span id='retail'>
Tadpole Children’s Shop<br />
</span>
<br />
</div>

I want the text and bg colors of the 'retail' fields to change color when the mouse rolls over a certain button on the page... i have onmouseover="document.getElementById('retail')className('highlight')" in the <td> of the button so it works but it doesnt highlight the second instance of 'retail'... any help would be appreciated!!

thanks,

- emeri

SlidingHorn
Jul 7th, 2009, 05:47 PM
You can only use a specific ID once throughout a page, so when it sees the first "retail" ID, you basically disqualify any other div or element throughout that page from being called "retail".

try using "class" instead.

emeri
Jul 7th, 2009, 06:45 PM
can you use document.getElementByClass?? instead of id?

thanks for your help!