开发者

Change .css file from javascript

开发者 https://www.devze.com 2023-03-19 12:16 出处:网络
I have this in a CSS file: #tabs .bg { backgroun开发者_如何学编程d: url(\"../images/bg-tabs-r.gif\") no-repeat scroll 100% 0 transparent;

I have this in a CSS file:

#tabs .bg {
    backgroun开发者_如何学编程d: url("../images/bg-tabs-r.gif") no-repeat scroll 100% 0 transparent;
    height: 39px;
    line-height: 42px;
    overflow: hidden;
    width: 100%;
}

Through JavaScript how do I change background to blank color and line-height to 28px.


If you use jQuery (you should) it's very easy:

$('#tabs .bg').css({'background': 'none', 'line-height': '28px'});


Use it directly on your element:

mytab=document.getElementById("tabs");
mytab.style.background="white";
mytab.lineHeight="28px";
0

精彩评论

暂无评论...
验证码 换一张
取 消