js网页特效漂亮的星级评价效果

<html>
<head>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<title>js网页特效漂亮的星级评价效果</title>
<style type="text/css">
body{
margin:0;padding:0 10px;color:#333;text-align:center;font:12px Arial,Helvetica,sans-serif;
}
h1,h2,h3,h4,h5,h6,form,ul,img{
margin:0;padding:0;border:0;
}
li{
list-style:none;
}
div#AddDP{
text-align:left;margin-top:20px;border:1px solid #ffdfb6;background:#fffbf5;
}
div#AddDP h5{
margin:0;padding:5px;background:#fff3dd;font-size:14px;
}
div#AddDP ul.Star{
margin-top:8px;margin-left:6em;
}
div#AddDP ul.Star li{
float:left;margin-right:8px;margin-bottom:5px;margin-bottom:0;list-style:none;
}
div#AddDP ul.Star li span.Select{
float:left;padding:5px;border:1px solid #ffcc00;display:block;
}
div#AddDP ul.Star li span.Select img{
vertical-align:middle;
}
</style>
<script language="javascript">
var sArray = new Object;
sArray[0] = new Image;
sArray[0].src = "http://www.5xsj.net/img/201201/icon_star_1.gif";
for (var i=1; i<6; i++) {
sArray[i] = new Image();
sArray[i].src = "http://www.5xsj.net/img/201201/icon_star_2.gif";
}
var starTimer;
var pro ;
var rate ;
function initStar() {
try {
setProfix("star_");
setStars(document.getElementById("rating").value,'rating');
setProfix("taste_");
setStars(document.getElementById("taste").value,'taste');
setProfix("price_");
setStars(document.getElementById("price").value,'price');
setProfix("environment_");
setStars(document.getElementById("environment").value,'environment');
} catch(e){
}
}
function showStars(starNum,rate) {
try {
clearStarTimer();
greyStars();
colorStars(starNum);
} catch(e){}
//setStars(starNum,rate);
}
function setProfix(profix) {
pro = profix ;
}
function colorStars(starNum) {
try {
for (var i=1; i <= starNum; i++) {
var tmpStar = document.getElementById(pro + i);
tmpStar.src = sArray[starNum].src;
}
} catch(e){}
}
function greyStars() {
try {
for (var i=1; i<6; i++) {
var tmpStar = document.getElementById(pro + i);
tmpStar.src = sArray[0].src;
}
} catch(e){}
}
function greyAll(curpro,currate) {
try {
document.getElementById(currate).value ="";
for (var i=1; i<6; i++) {
var tmpStar = document.getElementById(curpro + i);
tmpStar.src = sArray[0].src;
}
} catch(e){}
}
function setStars(starNum,rate) {
rate = rate ;
try {
clearStarTimer();
var rating = document.getElementById(rate);
rating.value = starNum;
showStars(starNum);
} catch(e){}
}
function clearStars(currate) {
rate = currate ;
try {
var rating = document.getElementById(rate);
if (rating.value != '') {
setStars(rating.value,rate);
} else {
greyStars();
}
} catch(e){}
}
function resetStars() {
try {
clearStarTimer();
var rating = document.getElementById(rate);
if (rating.value != '') {
setStars(rating.value,rate);
} else {
greyStars();
}
} catch(e){}
}
function clearStarTimer() {
if (starTimer) {
clearTimeout(starTimer);
starTimer = null;
}
}
</script>
</head>
<body>
<div id="AddDP">
<h5>添加点评</h5>
<form name="formappraisement" action="" method="post">
<input name="appraisementflag" id="appraisementflag" value="0" type="hidden">
<input id="appraisementcity" name="appraisementcity" value="168" type="hidden">
<input id="appraisementstoreid" name="appraisementstoreid" value="26135eea" type="hidden">
<input id="rating" name="serving" value="" type="hidden">
<input id="taste" name="taste" value="1" type="hidden">
<input id="price" name="price" value="5" type="hidden">
<input id="environment" name="environment" value="2" type="hidden">
<div>
<ul class="Star">
<li><span class="number">*</span>服务<span class="Select"> <a onmouseover="javascript:setProfix('star_');showStars(1,'rating');" onmouseout="javascript:setProfix('star_');clearStars('rating');" href="javascript:setProfix('star_');setStars(1,'rating');"><img id="star_1" title="差(1)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('star_');showStars(2,'rating');" onmouseout="javascript:setProfix('star_');clearStars('rating');" href="javascript:setProfix('star_');setStars(2,'rating');"><img id="star_2" title="一般(2)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('star_');showStars(3,'rating');" onmouseout="javascript:setProfix('star_');clearStars('rating');" href="javascript:setProfix('star_');setStars(3,'rating');"><img id="star_3" title="好(3)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('star_');showStars(4,'rating');" onmouseout="javascript:setProfix('star_');clearStars('rating');" href="javascript:setProfix('star_');setStars(4,'rating');"><img id="star_4" title="很好(4)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('star_');showStars(5,'rating');" onmouseout="javascript:setProfix('star_');clearStars('rating');" href="javascript:setProfix('star_');setStars(5,'rating');"><img id="star_5" title="非常好(5)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a> </span></li>
<li><span class="number">*</span>口味<span class="Select"> <a onmouseover="javascript:setProfix('taste_');showStars(1,'taste');" onmouseout="javascript:setProfix('taste_');clearStars('taste');" href="javascript:setProfix('taste_');setStars(1,'taste');"><img id="taste_1" title="差(1)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('taste_');showStars(2,'taste');" onmouseout="javascript:setProfix('taste_');clearStars('taste');" href="javascript:setProfix('taste_');setStars(2,'taste');"><img id="taste_2" title="一般(2)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('taste_');showStars(3,'taste');" onmouseout="javascript:setProfix('taste_');clearStars('taste');" href="javascript:setProfix('taste_');setStars(3,'taste');"><img id="taste_3" title="好(3)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('taste_');showStars(4,'taste');" onmouseout="javascript:setProfix('taste_');clearStars('taste');" href="javascript:setProfix('taste_');setStars(4,'taste');"><img id="taste_4" title="很好(4)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('taste_');showStars(5,'taste');" onmouseout="javascript:setProfix('taste_');clearStars('taste');" href="javascript:setProfix('taste_');setStars(5,'taste');"><img id="taste_5" title="非常好(5)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a> </span></li>
<li><span class="number">*</span>环境<span class="Select"> <a onmouseover="javascript:setProfix('environment_');showStars(1,'environment');" onmouseout="javascript:setProfix('environment_');clearStars('environment');" href="javascript:setProfix('environment_');setStars(1,'environment');"><img id="environment_1" title="差(1)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('environment_');showStars(2,'environment');" onmouseout="javascript:setProfix('environment_');clearStars('environment');" href="javascript:setProfix('environment_');setStars(2,'environment');"><img id="environment_2" title="一般(2)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('environment_');showStars(3,'environment');" onmouseout="javascript:setProfix('environment_');clearStars('environment');" href="javascript:setProfix('environment_');setStars(3,'environment');"><img id="environment_3" title="好(3)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('environment_');showStars(4,'environment');" onmouseout="javascript:setProfix('environment_');clearStars('environment');" href="javascript:setProfix('environment_');setStars(4,'environment');"><img id="environment_4" title="很好(4)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a><a onmouseover="javascript:setProfix('environment_');showStars(5,'environment');" onmouseout="javascript:setProfix('environment_');clearStars('environment');" href="javascript:setProfix('environment_');setStars(5,'environment');"><img id="environment_5" title="非常好(5)" src="http://www.5xsj.net/img/201201/icon_star_1.gif"></a> </span></li>
<li><span class="number">*</span>性价比<span class="Select"> <a onmouseover="javascript:setProfix('price_');showStars(1,'price');" onmouseout="javascript:setProfix('price_');clearStars('price');" href="javascript:setProfix('price_');setStars(1,'price');"><img id="price_1" title="差(1)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('price_');showStars(2,'price');" onmouseout="javascript:setProfix('price_');clearStars('price');" href="javascript:setProfix('price_');setStars(2,'price');"><img id="price_2" title="一般(2)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('price_');showStars(3,'price');" onmouseout="javascript:setProfix('price_');clearStars('price');" href="javascript:setProfix('price_');setStars(3,'price');"><img id="price_3" title="好(3)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('price_');showStars(4,'price');" onmouseout="javascript:setProfix('price_');clearStars('price');" href="javascript:setProfix('price_');setStars(4,'price');"><img id="price_4" title="很好(4)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a><a onmouseover="javascript:setProfix('price_');showStars(5,'price');" onmouseout="javascript:setProfix('price_');clearStars('price');" href="javascript:setProfix('price_');setStars(5,'price');"><img id="price_5" title="非常好(5)" src="http://www.5xsj.net/img/201201/icon_star_2.gif"></a> </span></li>
</ul>
</div>
<div style="clear:both"></div>
</form>
</div>
</body>
</html>

源地址:http://www.5xsj.net/Webs_View.asp?id=1094

时间: 2024-10-22 07:27:59

js网页特效漂亮的星级评价效果的相关文章

JS实现带提示的星级评分效果完整实例_javascript技巧

本文实例讲述了JS实现带提示的星级评分效果.分享给大家供大家参考,具体如下: 这是一款JS仿淘宝网的星级评分系统,鼠标放在上边可以显示星级代表的评分级别,鼠标点击时会选中当前的星级,目前此功能在网页上十分流行,虽然是仿做的,但已经很不错的功能了,希望大家喜欢! 运行效果截图如下: 在线演示地址如下: http://demo.jb51.net/js/2015/js-start-level-pf-codes/ 具体代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD

js网页特效-滑动条调节打字速度的效果

Aug. 15th(心情:挺不错的) 中国WEB第一站 网页,网页设计,网页制作,网页学习,网页教学,Photoshop,Flash,HTML,CSS,Dreamweaver,Fireworks,ASP,PHP,JSP,ASP.NET,网站建设,网站开发,网页特效,平面设计,个人网站,网页素材. 控制台 自动滚屏 动画速度(单击调节) 进度 日志评论

js网页特效-图片浮动效果代码

提示:您可以先修改部分代码再运行 提示:您可以先修改部分代码再运行

JS网页特效代码:切割网页图片特殊效果

JS效果之图片切割 DEMO1(随机出现): http://cnwander.com/demo/puzzle_effect/机器配置好的可以将图片切得更细一点 (变量xNum,yNum)DEMO1(规则运动): http://cnwander.com/demo/puzzle_effect/index2.html测试:IE6.IE7.FF3.014原文:http://cnwander.com/blog/?p=13 突发奇想的效果,主要突出构思,效果还比较粗糙,好好创意一下,应该可以引申出一些比较有

JS网页特效代码示例:特殊的水波文字

文章简介:水波文字效果. <html><head><title>水波文字效果</title></head><body bgcolor="#000000" onLoad="if (document.all)wave()"><center><div id='water' style='position:relative;width:400px;height:150px;font-f

js网页侧边随页面滚动广告效果实现_javascript技巧

a.scrollTop的计算: b.滚动元素的定位值计算: c.滚动周期设定: 代码如下: css部分: 复制代码 代码如下: /*测试用的高度*/ body{ height:3000px;} div,ul,li,body{margin:0; padding:0;} /*position:absolute;用于元素的定位*/ #roll{width:50px; height:100px; background:#99CC00; position:absolute;} Html代码: 复制代码 代

js网页特效代码:js代码特效

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><meta http-equiv="Content-Language" content="zh-CN" /><meta content="all" name="robots" /><meta name=&qu

网页特效/js超漂亮下拉菜单效果

提示:您可以先修改部分代码再运行 网页特效/js超漂亮下拉菜单效果 软件下载 播放软件下载 学习软件下载 游戏软件下载 提示:您可以先修改部分代码再运行

jQuery满意度星级评价插件特效代码分享_jquery

这是一款基于jQuery 的星级评分效果实例,鼠标滑过星星区域显示评论信息提交内容,适用在评论表单里面,是表单美化提交内容的一种用户体验设计.  为大家分享的jQuery满意度星级评价插件特效代码如下 <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>满意度jQuery星级评分插件</title> &l