<span class="pingstar">
<img src="images/star2.gif" />
<img src="images/star2.gif" />
<img src="images/star2.gif" />
<img src="images/star2.gif" />
<img src="images/star2.gif" />
<img src="images/star2.gif" />
<img src="images/star2.gif" />
</span>
<input id="hdnImpression" type="hidden" runat="server" />
<script type="text/javascript" language="javascript">
$(function () {
$(".pingstar img").mousemove(function () {
var $index = $(this).index();
$(".pingstar img").each(function (i) {
if (i <= $index) {
$(this).attr("src", "images/star1.gif");
}
else {
$(this).attr("src", "images/star2.gif");
}
})
return false;
})
$(".pingstar").mouseleave(function () {
var $index = $("#hdnImpression").val();
if ($index >= 0) {
$(".pingstar img").each(function (i) {
if (i <= $index) {
$(this).attr("src", "images/star1.gif");
}
else {
$(this).attr("src", "images/star2.gif");
}
})
}
else {
$(".pingstar img").attr("src", "images/star2.gif");
}
})
$(".pingstar img").click(function () {
var $index = $(this).index();
$("#hdnImpression").val($index);
$(".pingstar img").each(function (i) {
if (i <= $index) {
$(this).attr("src", "images/star1.gif");
}
else {
$(this).attr("src", "images/star2.gif");
}
})
return false;
})
})
</script>
Jquery星星评价插件
最新推荐文章于 2024-04-20 00:42:24 发布