为什么不会.getPropertyValue()返回“borderRadius”的值属性? [英] Why won't .getPropertyValue() return a value for the "borderRadius" property?
本文介绍了为什么不会.getPropertyValue()返回“borderRadius”的值属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里是函数:
function lastmenuborder(){
var articleparent = document.getElementById ').parentNode;
var articlestyle = window.getComputedStyle(articleparent,null).getPropertyValue('borderRadius');
alert(articlestyle);
}
我没有值,但父节点的css是: p>
div#mainbody div.placeholder {
border-radius:3px;
}
我必须改变什么才能返回3px?所有帮助非常感激; c> getPropertyValue()
$
解决方案<
<$> c $ c> .getPropertyValue('border-radius');
但是Firefox似乎需要使用这个语法的特定角落...
.getPropertyValue('border-top-left-radius');
Here is the function:
function lastmenuborder() {
var articleparent = document.getElementById('article').parentNode;
var articlestyle = window.getComputedStyle(articleparent,null).getPropertyValue('borderRadius');
alert (articlestyle);
}
I get no value, yet the css for the parent node is:
div#mainbody div.placeholder {
border-radius: 3px;
}
What would I have to change to return "3px"? All help greatly appreciated; I am still a newb at JavaScript.
解决方案
For getPropertyValue()
, you use hyphens instead of camelCase.
This works in Chrome...
.getPropertyValue('border-radius');
But Firefox seems to require specific corners using this syntax...
.getPropertyValue('border-top-left-radius');
这篇关于为什么不会.getPropertyValue()返回“borderRadius”的值属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文