首页 > 其他 > 详细

星星评分

时间:2017-11-20 11:35:39      阅读:311      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="zhaocom" content="http://www.zhaocom.xyz/" />
        <title>评分星星</title>
        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
            #grade
            {
                width: 180px;
                height: 30px;
            }
            #grade ul{
                list-style: none;
            }
            #grade ul li{
                width: 27px;
                height: 28px;
                background: url(img/star.gif) no-repeat;
                float: left;
            }
        </style>
        <script>
            window.onload=function(){
                var Ogae = document.getElementById(grade);
                var aLi = Ogae.getElementsByTagName(li);
                for(var i = 0;i<aLi.length;i++){
                    aLi[i].index=i;
                    aLi[i].onmouseover=function(){
                    for(var i = 0;i<aLi.length;i++){
                    if(i<=this.index){
                        aLi[i].style.background="url(img/star.gif) no-repeat 0 -29px";
                    }
                    else{
                        aLi[i].style.background="url(img/star.gif) no-repeat 0 0"
                    }
                }
                    }
                    
                    aLi[i].onmousedown=function(){
                        alert("提交完成:"+(this.index+1)+"")
                    }
                }
            }
        </script>
    </head>
    <body>
        <div id="grade">
            <ul>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
    </body>
</html>

技术分享图片

星星评分

原文:http://www.cnblogs.com/zhaocom/p/7865308.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!