jquery.raty-评级插件,很好用的
其中jquery.raty.min.js已经汉化了(其实就是翻译了下):
<script type="text/javascript" src="js/jquery.raty.min.js" charset="gbk"></script>
中的charset="gbk" 用其他的编码格式会乱码
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>
<title>jQuery Raty评级插件</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.raty.min.js" charset="gbk"></script>
</head>
<body>
<div id="star"></div>
<div class="session">以一个分数开始,只读:</div>
<div id="fixed"></div>
<div class="session">自己制定星星的个数:</div>
<div id="custom"></div>
<div class="session">自定义提示和图片:</div>
<div id="target"></div>
<div class="session">使用onclick回调函数:</div>
<div id="click"></div>
<div class="session">显示半颗星星:</div>
<div id="half"></div>
<div class="session">默认的取消按钮:</div>
<div id="cancel"></div>
<div class="session">自定义的取消按钮:</div>
<div id="cancel-custom"></div>
</body>
<script type="text/javascript">
$(function() {
$('div#star').raty();
$('div#fixed').raty({
readOnly: true,
start: 2
});
$('div#custom').raty({
scoreName: 'entity.score',
number: 10
});
$('div#target').raty({
hintList: ['2008冠军', '2009冠军', "2010冠军", '2011冠军', '2012冠军'],
starOn: 'medal-on.png',
starOff: 'medal-off.png'
});
$('div#click').raty({
onClick: function(score) {
alert('score: ' + score);
}
});
$('div#half').raty({
start: 3.3,
showHalf: true
});
$('div#cancel').raty({
showCancel: true
});
$('div#cancel-custom').raty({
cancelHint: '取消评级分数!',
cancelPlace: 'right',
showCancel: true,
onClick: function(score) {
alert('score: ' + score);
}
});
});
</script>
</html>
$(function() {
$('div#gjw').raty({
readOnly: false,
start: 0,
number: 5,
hintList: ['糟糕透了', '不理想', "一般般", '很好', '棒极了'],
starOn: 'medal-on.png',//设置图片,有默认的
starOff: 'medal-off.png',
showCancel: true,
cancelPlace: 'left',//取消按钮的位置
cancelHint: '取消评级分数!',
onClick: function(score) {
$("#score").val(score);
}
});
});
附带例子: