您的位置:首页 > Web前端 > JQuery

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

2010-03-09 15:29 288 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: