<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>网页特效-综合特效-优化的打分星星评价效果</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<script type="text/javascript">
function rate(obj,oEvent){
var imgSrc = '/Article/UploadFiles/201004/20100413173623532.gif';
var imgSrc_2 = '/Article/UploadFiles/201004/20100413173637882.gif';
if(obj.rateFlag) return;
var e = oEvent || window.event;
var target = e.target || e.srcElement;
var imgArray = obj.getElementsByTagName("img");
for(var i=0;i<imgArray.length;i++){
imgArray[i]._num = i;
imgArray[i].οnclick=function(){
if(obj.rateFlag) return;
alert(this._num+1);
var inputid=this.parentNode.previousSibling
inputid.value=this._num+1;
}
}
if(target.tagName=="IMG"){
for(var j=0;j<imgArray.length;j++){
if(j<=target._num){
imgArray[j].src=imgSrc_2;
} else {
imgArray[j].src=imgSrc;
}
target.parentNode.οnmοuseοut=function(){
var imgnum=parseInt(target.parentNode.previousSibling.value);
for(n=0;n<imgArray.length;n++){
imgArray[n].src=imgSrc;
}
for(n=0;n<imgnum;n++){
imgArray[n].src=imgSrc_2;
}
}
}
} else {
return false;
}
}
</script>
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<input type="hidden" value="0"><p οnmοuseοver="rate(this,event)">
<img src="/Article/UploadFiles/201004/20100413173623532.gif" title="很烂"><img src="/Article/UploadFiles/201004/20100413173623532.gif" title="一般"><img src="/Article/UploadFiles/201004/20100413173623532.gif" title="还好"><img src="/Article/UploadFiles/201004/20100413173623532.gif" title="较好"><img src="/Article/UploadFiles/201004/20100413173623532.gif" title="很好">
</p>
</body>
</html>
优化的打分星星评价效果
转载
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
20240930_210751 scratch 应用题 猫咪追星星bc d3 f5
-
RatingBar 选星星 打分
1、功能介绍2、代码架构3、布局文件 activity_main.xml4、功能代码 MainActivity.java1、功能介绍选星星打分2、代码架构3、
RatingBar android xml ide -
简单星星评价功能,小程序mpvue
小程序手写星星评价效果
ico 代码片段 小程序 js代码 html