a.html 3.34 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jquery星星评论动画效果</title>

<script src="jquery.min.js"></script>
<link href="stars.css" type="text/css" rel="stylesheet">
<script src="stars.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        var options	= {
        max	: 5,
        title_format	: function(value) {
            var title = '';
            switch (value) {
                case 1 : 
                    title	= '很不满意';
                    break;
                case 2 : 
                    title	= '不满意';
                    break;
                case 3 : 
                    title	= '一般';
                    break;
                case 4 : 
                    title	= '满意';
                    break;
                case 5 : 
                    title	= '非常满意';
                    break;
                default :
                    title = comment_rank;
                    break;
            }
            $('#rank').val(value);
            //alert(value);
            //alert(title);
            return title;
        },
            info_format	: function(value) {
            var info = '';
            switch (value) {
                case 1 : 
                    info	= '<div class="info-box">1分&nbsp;很不满意<div>商品样式和质量都非常差,太令人失望了!</div></div>';
                    break;
                case 2 : 
                    info	= '<div class="info-box">2分&nbsp;不满意<div>商品样式和质量不好,不能满足要求。</div></div>';
                    break;
                case 3 : 
                    info	= '<div class="info-box">3分&nbsp;一般<div>商品样式和质量感觉一般。</div></div>';
                    break;
                case 4 : 
                    info	= '<div class="info-box">4分&nbsp;满意<div>商品样式和质量都比较满意,符合我的期望。</div></div>';
                    break;
                case 5 : 
                    info	= '<div class="info-box">5分&nbsp;非常满意<div>我很喜欢!商品样式和质量都很满意,太棒了!</div></div>';
                    break;
                default :
                    info = value;
                    break;
            }
            return info;
        }
    }
        $('#rate-comm-1').rater(options);
})
</script>
<!--对评分内容判断-->
</head>
<body>
<center>
<form action="javascript:;" onsubmit="submitComment(this)">

<div class=box-163css>
	<div class="mb10 goods-comm-stars clearfix" style="position:relative;z-index:2;">
		<div class=fl><SPAN class="color-r mr5">*</SPAN>商品满意度:</div>
		<div class=rate-comm id=rate-comm-1></div>
		<br><br>

	</div>
</div>


<input name="rank" id="rank" type="hidden" value=""><br><br>
<input name="submit1" type="submit" value=" 提交评分 ">
</form>

</center>
<script type="text/javascript">
function submitComment(frm)
{
  var cmt = new Object;
  cmt.rank	 = frm.elements['rank'].value;

        alert(cmt.rank);
        return false;
}
</script>

</body></html>