XML DOM insertRule() ກົນລະບຽບ
ການກໍານົດແລະການນໍາໃຊ້
ກົນລະບຽບ insertRule() ທີ່ສະເໜີກົດລະບຽບໃນກົດລະບຽບສອນ。
ນິຍົມວິທະຍາສາດ:
insertRule(rule,index)
ຫຼັກສັດ | Description |
---|---|
rule |
ຕ້ອງການ。ຕົວອັກຄັບຂອງກົດລະບຽບທີ່ສົມບູນແລະສາມາດໄດ້ຄົ້ນຫາຄວາມຄົບຖ້ວຍຫຼາຍຄວາມທີ່ສົມບູນ。
|
index | Required. The position to insert or append the rule to the cssRules array. |
Return value
The value of the parameter index.
Throw
This method will throw a DOMException with the following code under the following conditions: DOMException exception:
- HIERARCHY_REQUEST_ERR
- CSS syntax does not allow the specified rule to appear at the specified position.
- INDEX_SIZE_ERR
- index Does not correspond to any rule in the rule set of the stylesheet, such as index Is a negative number or a value greater than cssRules.length.
- NO_MODIFICATION_ALLOWED_ERR
- The stylesheet is read-only.
- SYNTAX
- specified rule Text has text error.
Description
ວິທະຍາສາດຈະຕັ້ງຄວາມຕັ້ງຫນັງໃນ array cssRules ຂອງ sheet index ທີ່ເພີ່ມ (ຫລື ຕິດຕັ້ງ) CSS rule ໃນຂອບເຂດ. ນີ້ແມ່ນວິທະຍາສາດ DOM ມາດຕະຖານ, ການເບິ່ງ CSSStyleSheet.addRule()ແມ່ນວິທະຍາສາດທີ່ພົບກັບ IE
Example
ອອກຂອບເຂດຈະເພີ່ມເບື້ອງທີ່ສຸດຂອງ sheet ວິຊາແບບ
myStyle.insertRule("#blanc { color: white }", 0);
Pages related
XML DOM Reference Manual:CSSStyleSheet.addRule()