开发者

Change .css file from javascript

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜