jquery 不同浏览器判断颜色值的方法

jquery 不同浏览器判断颜色值的方法

//CSS处理函数
function mycss(){
   
if($.browser.msie){    //IE浏览器
//HOVER事件
$('#table1 > tbody > tr').hover(function(evt){
 if ($(this).find('td').css("background-color")!='#009fcc'){   
  $(this).find('td').css("background-color","#CCDDFF");
 }
}, function(evt){
 if ($(this).find('td').css("background-color")!='#009fcc'){   
 $(this).find('td').css("background-color","");
 }
} );
}

if($.browser.mozilla) {    //FF浏览器
//HOVER事件
$('#table1 > tbody > tr').hover(function(evt){
 if ($(this).find('td').css("background-color")!='rgb(0, 159, 204)'){   
  $(this).find('td').css("background-color","#CCDDFF");
 }
}, function(evt){
 if ($(this).find('td').css("background-color")!='rgb(0, 159, 204)'){   
 $(this).find('td').css("background-color","");
 }
} );
}

}

$(this).find('td').css("background-color") 在不同浏览器下返回的值是不一样的。

当页面载入式判断浏览器类型,可判断的类型有msie、mozilla、opera、safa

原文地址:https://www.cnblogs.com/fengju/p/6173811.html