首页 > 编程 > JavaScript > 正文

运用jquery实现table单双行不同显示并能单行选中

2019-11-21 01:14:55
字体:
来源:转载
供稿:网友
复制代码 代码如下:

$(document).ready(function(){
$("p:odd").css("background-color", "#bbf");
$("p:even").css("background-color","#ffc");
$("p").click(function () {
$("p").each(function(){
if($(this).hasClass("highlight")){
$(this).removeClass("highlight");
}});
$(this).addClass("highlight");
});
});

源码参考gamil:test_jquery_table
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表