1。当一个表格的某一行被点击的时候,这一行的背景色就变为红色,当这一行再次被点击时,就变成原来一样的背景色。
$(document).ready(function(){
$("tr").live("click",function(){
if($(this).css("background")=="red"){
$(this).css("background","");
}else{
$(this).css("background","red");
$("tr").not($(this)).css("background","");
}
});
});
本文介绍了一种使用jQuery实现的表格行点击变色效果:点击某一行时,该行背景变为红色;再次点击则恢复原色。同时确保当前选中行与其他行区分显示。
345

被折叠的 条评论
为什么被折叠?



