Return the value of the color property:
var declaration = document.styleSheets[0].cssRules[0].style;
var propvalue = declaration.getPropertyValue("color");
alert(propvalue);
Try it Yourself »
The getPropertyValue() method returns the value of the specified CSS property.
Method | |||||
---|---|---|---|---|---|
getPropertyValue() | Yes | 9.0 | Yes | Yes | Yes |
object.getPropertyValue(
propertyname)
Parameter | Description |
---|---|
propertyname | Required. A String representing the name of the property to check |
DOM Version: | CSS Object Model |
---|---|
Return Value: | A String, representing the value of the property |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!