попробуйте это.это то, что я сделал для веб-сайта
html code
<div id="rating">
<div id="star1">
<img src="images/on.png" alt="1"/>
</div>
<div id="star2">
<img src="images/on.png" alt="2"/>
</div>
<div id="star3">
<img src="images/on.png" alt="3"/>
</div>
<div id="star4">
<img src="images/on.png" alt="4"/>
</div>
<div id="star5">
<img src="images/on.png" alt="5"/>
</div>
</div>
<input type="hidden" name="ratingval" id="ratingval" value="0" />
js script
$(document).ready(function(){
stars = ['off','off','off','off','off','off'];
clearRating();
$('#star1 img').click(function(){ rateTheStar(1);});
$('#star2 img').click(function(){ rateTheStar(2);});
$('#star3 img').click(function(){ rateTheStar(3);});
$('#star4 img').click(function(){ rateTheStar(4);});
$('#star5 img').click(function(){ rateTheStar(5);});
});
// Bl holder functions
function clearRating() {
count = 1;
for(count = 1; count <= 5; count++) {
strTarget = '#star'+count+' img';
$(strTarget).animate({'opacity':0});
}
}
function rateTheStar(targetno) {
if(stars[targetno] == 'off') {
target = '';
i = 0;
j = 0;
for(j = 1; j <= targetno; j++) {
target = '#star'+j+' img';
stars[j] = 'on';
$(target).animate({'opacity':1},'slow');
}
document.getElementById('ratingval').value = targetno;
for(i = targetno+1; i <= 5; i++) {
str = '#star'+i+' img';
$(str).animate({'opacity':0},'slow');
}
//alert(stars[1]+" "+stars[2]+" "+stars[3]+" "+stars[4]+" "+stars[5]);
}
else if(stars[targetno] == 'on') {
document.getElementById('ratingval').value = targetno;
i = 0;
newTargetNo = targetno + 1;
for(i = newTargetNo; i <= 5; i++) {
str = '#star'+i+' img';
stars[i] = 'off';
$(str).animate({'opacity':0},'slow');
}
}
}
css file
#rating {
width:120px;
height:34px;
display:inline;
overflow:hidden;
display:block;
}
#rating img {
background-image:url(../images/off.png);
}
#star1 {
width:20px;
height:32px;
float:left;
background-image:url(../images/off.png);
}
#star2 {
width:20px;
height:32px;
float:left;
background-image:url(../images/off.png);
}
#star3 {
width:20px;
height:32px;
float:left;
background-image:url(../images/off.png);
}
#star4 {
width:20px;
height:32px;
float:left;
background-image:url(../images/off.png);
}
#star5 {
width:20px;
height:32px;
float:left;
background-image:url(../images/off.png);
}
images: http://thewoodhouse.net/jukebox/images/on.png и http://thewoodhouse.net/jukebox/images/off.png
вы можете попробовать код в этом файле HTML образца http://thewoodhouse.net/jukebox/admin.html