Jquery特效 评分代码(星级评分)
本文导语: 例子,Jquery 评分代码。 代码示例: Jquery 评分代码_www. #tbl{border-collapse:collapse;border-top:1px solid red;border-left:1px solid red;} #tbl td{border-collapse:collapse;border-bottom:1px solid red;b...
例子,Jquery 评分代码。
Jquery 评分代码_www.
#tbl{border-collapse:collapse;border-top:1px solid red;border-left:1px solid red;}
#tbl td{border-collapse:collapse;border-bottom:1px solid red;border-right:1px solid red;}
#main{width:100px;text-align:center;margin:0px auto;}
var $tds;
var div;
var bClick = false;
$(function () {
$tds = $("#tbl td");
div = document.getElementById("main");
bClick = false;
$tds.mouseover(function () {
if (!bClick) {
var $currentTd = $(this);
$currentTd.css("backgroundColor", "green");
var $preTds = $currentTd.prevAll("td");
$preTds.css("backgroundColor", "green");
var $nextTds = $currentTd.nextAll("td");
$nextTds.css("backgroundColor", "white");
}
});
$tds.mouseout(function () {
if (!bClick) {
$tds.css("backgroundColor", "white");
}
//alert(div.innerHTML);
});
$tds.click(function () {
bClick = true;
var $currentTd = $(this);
$currentTd.css("backgroundColor", "green");
var $preTds = $currentTd.prevAll("td");
$preTds.css("backgroundColor", "green");
var $nextTds = $currentTd.nextAll("td");
$nextTds.css("backgroundColor", "white");
});
});
★
★
★
★
★