运用jquery实现table单双行不同显示并能单行选中
(编辑:jimmy 日期: 2025/5/14 浏览:3 次 )
复制代码 代码如下:
$(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
$(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
下一篇:用JQuery 实现AJAX加载XML并解析的脚本