日期:2014-05-17  浏览次数:20665 次

鼠标移动的小问题
小小的常见的简单的一般的功能:  
评分的时候   有5颗星星   随着鼠标移动   星星变亮。。。然后点击   打分。。


实在懒   抱歉啊   谢谢every   budy
最好来点代码   thx

------解决方案--------------------
每个星星都是一个链接,给它们定义个hover样式就OK
------解决方案--------------------
<html>
<style>
#AllStars img{
cursor:hand;
}
</style>
<script>
function showStar(star){
var scores=star.Scores;
var imgs=document.getElementById( "AllStars ").getElementsByTagName( "img ");
for(var i=0;i <imgs.length;i++){
if(imgs[i].Scores <=scores){
imgs[i].src= "02.gif ";
}
}
}
function hideStar(){
var imgs=document.getElementById( "AllStars ").getElementsByTagName( "img ");
for(var i=0;i <imgs.length;i++){
imgs[i].src= "01.gif ";
}
}
</script>

<body>
<div id= "AllStars ">
<img src= "01.gif " Scores= "1 " onmouseover= "showStar(this) " onmouseout= "hideStar() " />
<img src= "01.gif " Scores= "2 " onmouseover= "showStar(this) " onmouseout= "hideStar() " />
<img src= "01.gif " Scores= "3 " onmouseover= "showStar(this) " onmouseout= "hideStar() " />
<img src= "01.gif " Scores= "4 " onmouseover= "showStar(this) " onmouseout= "hideStar() " />
<img src= "01.gif " Scores= "5 " onmouseover= "showStar(this) " onmouseout= "hideStar() " />
</div>
</body>
</html>
------解决方案--------------------
还是ajax咯...