Volodymyr Osypov blog

May 23, 2008

HTML DOM, JavaScript to add/remove table rows (part 2)

Filed under: JavaScript — Tags: , — admin @ 3:01 pm

I’ve promised you to improve table row delete function, that’s what we will do today. So now we know the differences of DOM tree in different browsers. We saw that Firefox and Safari create additional text node “\n” so there are two ways to fix our delete row function: 1st - to delete these nodes, 2nd - just to pass them through.
(more…)

May 21, 2008

Print HTML DOM Tree

Filed under: JavaScript — Tags: , , — admin @ 11:14 am

In previous article we programmed two functions: to add and remove a table row. But we had one issue in Safari and Firefox by removing a row. We had to click Delete button twice. To understand why this happens we need to see the DOM tree of our table, which each browser builds. You can use browser plugins, but now we will just develop our own simple JavaScript function to print DOM tree.
(more…)

May 20, 2008

HTML DOM, JavaScript to add/remove table rows (part 1)

Filed under: JavaScript — Tags: , , , — admin @ 8:33 pm

I hope you know what DOM is. If no, then I would advise you to read first this tutorial.

We will try to write JavaScirpt code to add/remove rows to table but without using DHTML functions (addRow, addCell etc.), we will use functions to manipulate with DOM tree like appendChild, createElement, createTextNode.
(more…)

Powered by WordPress