

于是翻出了前年的Jquery中文文档。 大致浏览了下Jquery的方法。发现Jquery如此之强大,怎么以前就没有发现呢?于是就亲手写了基于Jquery的扩展函数,代码如下:
代码如下:
jQuery.fn.__toggleCheck = function (idPrefix) {
var c = false;
$(this).click(function () {
if (c) c = false;
else c = true;
$("input[type=checkbox][id^=" + idPrefix + "]").each(
function () {
this.checked = c;
}
);
});
};
jQuery.fn.__setRepeaterStyle = function (itemTag, evenStyle, hoverStyle) {
$("#" + this.attr("id") + " " + itemTag + ":odd").addClass(evenStyle);
var cssOriginal = "";
$("#" + this.attr("id") + " " + itemTag + "").mouseover(function () {
cssOriginal = $(this).attr("class");
$(this).addClass(hoverStyle);
});
$("#" + this.attr("id") + " " + itemTag + "").mouseout(function () {
$(this).removeClass();
if (cssOriginal.length > 0) {
$(this).addClass(cssOriginal);
}
});
};
以上函数调用如下:
代码如下:
1
2
3
4
5
6
All
Check
| 1 |
| 1 |
| 1 |
