CSSStyleDeclaration getPropertyPriority() 方法
實例
返回 color 屬性是否設置了 "important!" 優先順序:
var declaration = document.styleSheets[0].cssRules[0].style;
var priority = declaration.getPropertyPriority("color");
alert(priority);
定義和使用
getPropertyPriority() 方法返回指定的 CSS 屬性是否設置了 "important!" 優先順序。如果返回 "important" 則表明設置了優先順序,否則沒有。
流覽器支持
方法 | |||||
---|---|---|---|---|---|
getPropertyPriority() | Yes | 9.0 | Yes | Yes | Yes |
語法
object.getPropertyPriority(propertyname)
屬性值
參數 | 描述 |
---|---|
propertyname | 必需。一個字串,表示要檢測的屬性名。 |
技術細節
DOM 版本: | CSS Object Model |
---|---|
返回值: | 字串, 表示設置了優先順序,如果為空則表示沒有設置優先順序。 |