<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div>
<span>☆</span>
<span>☆</span>
<span>☆</span>
<span>☆</span>
<span>☆</span>
</div>
<script>
$(function () {
$("span").on({
"mouseover":function () {
var index = $(this).index();
$("span:lt("+(index+1)+")").text("★");
}, "mouseout":function () {
var index = $(this).index();
$("span:lt("+(index+1)+")").text("☆");
},"click":function () {
var index = $(this).index();
$("span:lt("+(index+1)+")").text("★");
$("span").off();
}
})
})
</script>
</body>
</html>
效果图;