CSSStyleDeclaration सेटप्रॉपर्टी () विधि
उदाहरण
एक नया CSS गुण सेट करें:
var declaration = document.styleSheets[0].cssRules[0].style;
var setprop = declaration.setProperty("background-color",
"yellow");
परिभाषा और उपयोग
सेटप्रॉपर्टी () विधि एक सीएसएस डिक्लेरेशन ब्लॉक में एक नया सेट करती है या मौजूदा सीएसएस प्रॉपर्टी को संशोधित करती है।
ब्राउज़र समर्थन
Method | |||||
---|---|---|---|---|---|
setProperty() | Yes | 9.0 | Yes | Yes | Yes |
वाक्य - विन्यास
object.setProperty(propertyname, value, priority)
पैरामीटर मान
Parameter | Description |
---|---|
propertyname | Required. A String representing the name of the property to set |
value | Optional. A String representing the new value |
priority | Optianal. A String representing if the property's priority should be set to
important or not. Legal values: "important" undefined "" |
टेक्निकल डिटेल
डोम संस्करण: | सीएसएस ऑब्जेक्ट मॉडल |
---|---|
प्रतिलाभ की मात्रा: | अपरिभाषित |
और ज्यादा उदाहरण
उदाहरण
"महत्वपूर्ण" प्राथमिकता के साथ एक नई सीएसएस संपत्ति सेट करें:
var declaration = document.styleSheets[0].cssRules[0].style;
var setprop = declaration.setProperty("background-color",
"yellow", "important");
उदाहरण
मौजूदा सीएसएस संपत्ति को संशोधित करें:
var declaration = document.styleSheets[0].cssRules[0].style;
var setprop = declaration.setProperty("color",
"blue");
CSSStyleDeclaration Object