XHTML, CSS, Javascript, Browser Notes

Wednesday, June 21, 2006

DOM notes

I've recently been converting one of our tools from a raw html/innerHTML backend to DOM implementation, in order to: 1) Save processing time 2)More easily update and interact with the tool 3) Learn more about the DOM. Here's what I've learned thus far.
*Note* - Lately for time-saving purposes, I have only dealt with mozilla and Internet Explorer, the two market leaders. Therefore, these notes may need to be supplemented. Commment below if you notice any such cases.

DOM Table References

http://msdn.microsoft.com/workshop/author/tables/buildtables.asp

** This is missing one important note ("insertCell with Mozilla" below).

http://developer.mozilla.org/en/docs/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces


** IMPORTANT ** insertCell/insertRow with Mozilla
When using insertCell/insertRow with Mozilla, you must pass an argument. If you don't, it will error, but won't alert you. For example:

To insert a row at the end(default)
Pass -1 as the argument.
tbody.insertRow(-1)

To insert a row at the beginning of the rows
Pass 0 as the argument.
tbody.insertRow(-1)

For more information, see
Mozilla documentation on insertRow

0 Comments:

Post a Comment

<< Home