$(".bstar1").mouseenter(function(e){$('.bstar1').prop('src','images/star.png');});就是指標在哪裡,黃星星就會補滿bstar是灰的star是黃的我越寫越不對,這樣好像不通?怎麼寫才對?_____________________________更新我寫這樣$('.rate_bstar').hover(function(){$(this).prevAll().prop('src','images/star.png');$(this).prop('src','images/star.png');$(this).nextAll().prop('src','images/bstar.png');},function(){$(this).prevAll().prop('src','images/bstar.png');$(this).prop('src','images/bstar.png');$(this).nextAll().prop('src','images/bstar.png');});發現這樣可以,但我點擊後我想讓他停在那個狀態,不要消失
2 回答

SMILET
TA贡献1796条经验 获得超4个赞
$("#startImg").on("click",'img',a)$('#startImgimg').hover(a,b);functiona(){$(this).attr('src','images/star.png')$(this).prevAll().attr('src','images/star.png')$(this).nextAll().attr('src','images/bstar.png');}functionb(){$('#startImgimg').attr('src','images/bstar.png');}

回首忆惘然
TA贡献1847条经验 获得超11个赞
$(".rate_bstar").mouseenter(function(e){$(this).attr('src','images/star.png').prevAll().attr('src','images/star.png');});鼠标离开的时候全部改回来就行了。