开发者

JavaScript: Set border radius

How can I set the -moz-border-radius with pure JavaScript (no jQuery, no plugins etc)?

document.getElementById(开发者_如何转开发'id')


Try:

document.getElementById('id').style.borderRadius = '1em'; // w3c
document.getElementById('id').style.MozBorderRadius = '1em'; // mozilla

But why not do it in a stylesheet?


var myElementStyle = document.getElementById('id').style;

myElementStyle.borderRadius = '1em'; // standard
myElementStyle.MozBorderRadius = '1em'; // Mozilla
myElementStyle.WebkitBorderRadius = '1em'; // WebKit
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜