好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

jQuery找到指定背景颜色的td_html/css_WEB-ITnose

怎么找到指定颜色的td表格
----
$("#hutNew").find("td").each(function () {                    if ($(this).attr('style') == 'background:rgb(34, 139, 34)') {                        $(this).css({ "width": "140px", "cursor": "pointer" });                    } else if ($(this).attr('style') == 'background:none') {                        $(this).css("background", "rgb(85, 85, 85)");                    }                }); 

-------
这个方法不好使啊
---


回复讨论(解决方案)

定义cssclass用class来找

定义cssclass用class来找

具体说一下

.backcolor{background:rgb(34, 139, 34)} 

if($(this).attr('class')=="backcolor"){//} 

.backcolor{background:rgb(34, 139, 34)} 

if($(this).attr('class')=="backcolor"){//} 



多钟颜色的背景 是不是要定义多个class

.backcolor{background:rgb(34, 139, 34)} 

if($(this).attr('class')=="backcolor"){//} 

好吧 试过了 不行
我要实现多次点击一个Td 然后两种颜色不停的变化 记录下最后一次点击的改变后的颜色 class 好像 只能点击一次


.backcolor{background:rgb(34, 139, 34)} 

if($(this).attr('class')=="backcolor"){//} 



多钟颜色的背景 是不是要定义多个class

keyile

查看更多关于jQuery找到指定背景颜色的td_html/css_WEB-ITnose的详细内容...

  阅读:42次