JQuery 评分系统

         

 

评分:

 

<!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>
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tbl1 td").text("").css("cursor", "pointer").mouseover(function () { $("#tbl1 td").text("").css("color", "red"); $(this).nextAll("td").text("").css("color", "Black"); });

            $("#tbl2").mouseover(function () { $(this).siblings("td").text("").css("color", "Black"); }); //鼠标指向“评分:”时0星
            $(".grade").click(function () { alert($(this).attr("title")) }); //"attr"概述:设置或返回被选元素的属性值。
            $(".grade").css("cursor", "pointer").mouseover(function () { $(".grade").text("").css("color", "red"); $(this).nextAll("td").text("").css("color", "Black"); });
        });
    </script>
</head>
<body>
<table id="tbl1">
    <tr><td></td><td></td><td></td><td></td><td></td></tr>
</table>
<p></p>
<table>
    <tr><td id="tbl2">评分:</td><td class="grade" title="一星">☆</td><td class="grade" title="二星">☆</td><td class="grade" title="三星">☆</td><td class="grade" title="四星">☆</td><td class="grade" title="五星">☆</td></tr>
</table>
</body>
</html>

 

posted @ 2013-08-01 02:58  hg一如既往  阅读(322)  评论(0编辑  收藏  举报