I want users to be able to select a rating for a media object on my site by clicking on 1-5 stars. The trick is i want every star up to the one on mouseover to highlight. So if they’re holding the cursor over star 4, then stars 1, 2 and 3 are also highlighted. The stars are currently set up like so…
[code]<table id=”rating”>
<tr>
<td><a href=”link”></a></td>
<td><a href=”link”></a></td>
<td><a href=”link”></a></td>
<td><a href=”link”></a></td>
<td><a href=”link”></a></td>
</tr>
</table>
there is already a mouseover set for each star (by moving the position of the background image) so my js will only have to affect the stars previous to it…here’s the function i’m trying to use to make this happen, but it’s not working (not throwing any errors either??) BTW, “$” is a shortcut for document.getElementById…
[code] if($(‘rating’)) {
var stars=$(‘rating’).getElementsByTagName(‘A’);
for(var x=0; x<stars.length; x++) {
if(x>0) {
stars[x].onmouseover=function() {
for(var i=x; i<x; i–) {
alert(‘on’);
stars[i].style.backgroundPosition=’0 -17px’;
}
}
stars[x].onmouseout=function() {
for(var i=x; i<x; i–) {
alert(‘off’);
stars[i].style.backgroundPosition=’0 0′;
}
}
}
}
}