我写了个脚本如下:
if($(".x-table tr").css('style') == "background-color:grey") {
$(this).mouseover(function () {
$(this).css("background-color","yellow");
}).mouseout(function () {
$(this).css("background-color","grey");
});}
但是执行这个脚本后,并没有生效,请问有人知道是哪里出问题了吗?我怀疑是不是“”选中背景色为灰色的行“”这个命令有问题,但我不知道咋修改。
页面的表格是灰白相间的,所以只能分开设置鼠标悬浮变更背景色:
if($(".x-table tr").css('style') == "background-color:grey") {
$(this).mouseover(function () {
$(this).css("background-color","yellow");
}).mouseout(function () {
$(this).css("background-color","grey");
});}
else if($(".x-table tr").css('style') == "background-color:white") {
$(this).mouseover(function () {
$(this).css("background-color","yellow");
}).mouseout(function () {
$(this).css("background-color","white");
});}
但是执行第一个if的时候就不行了。
我用jq写了个脚本想实现:鼠标悬浮在页面表格中背景色为灰色的行,变更其背景色
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-