js+css设计html页面点亮星星评分效果

2个月前 (03-25 15:57)阅读47回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4714
  • 级别管理员
  • 主题942
  • 回复2
楼主

很漂亮实用评分效果,让用户点亮星星进行评分,显示评分所对应的评语,可根据自己的需求来自定义。

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>js+css设计html页面点亮星星评分效果_武鸣人</title>
<style type="text/css">
ul, li {margin: 0; padding: 0; border: 0;}
.www_wuming_ren {
height: 25px;
overflow: hidden;
zoom: 1;
padding: 2px 0;
position: relative;
z-index: 999;
font:12px Arial;
color:#000;
line-height:1.2em
}
.www_wuming_ren span {
height: 23px;
display: block;
line-height: 23px;
float: left;
}
.www_wuming_ren span.wuming_ren {
width: 125px;
text-align: right;
margin-right: 5px;
}
.www_wuming_ren ul {
float: left;
}
.www_wuming_ren .result {
margin-left: 20px;
padding-top: 2px;
}
.www_wuming_ren .result span {
color: #ff6d02;
}
._wuming_ren,
._wuming_ren a {
background: url(/img/20240325_www_wuming_ren_7.png) no-repeat scroll 1000px 1000px;
}
._wuming_ren {
background-position: 0px 0px;
width: 120px;
height: 23px;
position: relative;
z-index: 1000;
}
.www_wuming_ren .result em {
color: #f60;
font-family: arial;
font-weight: bold;
}
._wuming_ren li {
display: inline;
}
._wuming_ren a {
line-height: 23px;
height: 23px;
position: absolute;
top: 0px;
left: 0px;
text-indent: -999em;
*zoom: 1;
outline: none;
}
._wuming_ren a.one-star {
width: 20%;
z-index: 6;
}
._wuming_ren a.two-stars {
width: 40%;
z-index: 5;
}
._wuming_ren a.three-stars {
width: 60%;
z-index: 4;
}
._wuming_ren a.four-stars {
width: 80%;
z-index: 3;
}
._wuming_ren a.five-stars {
width: 100%;
z-index: 2;
}
._wuming_ren .current-rating, ._wuming_ren a:hover {background-position:0 -28px}
._wuming_ren a.one-star:hover,._wuming_ren a.two-stars:hover,._wuming_ren a.one-star.current-rating,._wuming_ren a.two-stars.current-rating{background-position:0 -116px;}
._wuming_ren .three-stars .current-rating,._wuming_ren .four-stars .current-rating,._wuming_ren .five-stars .current-rating{background-position:0 -28px;}
</style>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div class="www_wuming_ren">
<span class="wuming_ren">武鸣人网站什么样?:</span>
<ul class="_wuming_ren" id="www_wuming_">
<li><a href="javascript:void(0);" class="one-star" star:value="20">20</a></li>
<li><a href="javascript:void(0);" class="two-stars" star:value="40">40</a></li>
<li><a href="javascript:void(0);" class="three-stars" star:value="60">60</a></li>
<li><a href="javascript:void(0);" class="four-stars" star:value="80">80</a></li>
<li><a href="javascript:void(0);" class="five-stars" star:value="100">100</a></li>
</ul>
<span id="stars2-tips" class="result"></span>
<input type="hidden" id="stars2-input" name="b" value="" size="2" />
</div>
<script>
var TB = function() {
var T$ = function(id) { return document.getElementById(id) }
var T$$ = function(r, t) { return (r || document).getElementsByTagName(t) }
var Stars = function(cid, rid, hid, config) {
var lis = T$$(T$(cid), 'li'), curA;
for (var i = 0, len = lis.length; i < len; i++) {
lis[i]._val = i;
lis[i].onclick = function() {
T$(rid).innerHTML = '<em>' + (T$(hid).value = T$$(this, 'a')[0].getAttribute('star:value')) + '分</em> - ' + config.info[this._val];
curA = T$$(T$(cid), 'a')[T$(hid).value / config.step - 1];
};
lis[i].onmouseout = function() {
curA && (curA.className += config.curcss);
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
lis[i].onmouseover = function() {
curA && (curA.className = curA.className.replace(config.curcss, ''));
}
}
};
return {Stars: Stars}
}().Stars('www_wuming_', 'stars2-tips', 'stars2-input', {
'info' : ['网站极差', '网站不咋地', '网站一般吧', '网站不错', '网站极好啊'],
'curcss': ' current-rating',
'step': 20
});
</script>
</body>
</html>


0
0
收藏0
回帖

js+css设计html页面点亮星星评分效果 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息