Use the JS operation page table, some tips for the element

xiaoxiao2021-03-31  217

(One)

IE, Firefox, and other browsers have different operations of the Table tag, and the IE does not allow Table and TR's InnerHTML assignment. When using JS to increase a TR, use the appendchile method or not. Below is the result of me three browser tests: INSERTROW

IE6: Support, and the default parameter is -1, the default is added to the last Firefox: support, but the department supports the default parameters Opera: support, support the default parameters, the default is added to the forefront

Appendchild

IE6: Firefox: Support, but does not affect ROWSOPERA: Support after increasing TR, effects with INSERTROW (-1), affects Rows

To follow the specification, you can write safe, applicable code: // Add an empty line to Table: var otr = otable.insertrow (-1); var odd = Document.createElement ("TD" ); otd.innerhtml = ""; otd.classname = "xxxx"; otr.appendchild (ot); this can run on these three browsers

(3) CHILDNODES operation

(1) Property Nodename

Utils.getchildrenbyTagname = function (node, tagname) {var ln = node.childNodes.LENGTH; var arr = []; for (var z = 0; z

(2) Attribute ID

Function GetNodeId (PARENT, ID) {var ln = parent.childNodes.Length; for (var z = 0; z

Corresponding to class, such as

转载请注明原文地址:https://www.9cbs.com/read-130874.html

New Post(0)