开发者

JavaScript: Set border radius

开发者 https://www.devze.com 2022-12-13 01:13 出处:网络
How can I set the -moz-border-radius with pure JavaScript (no jQuery, no plugins etc)? document.getElementById(开发者_如何转开发\'id\')

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

精彩评论

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