[Javascript] Combining 2 tables

Hassan Schroeder hassan at webtuitive.com
Fri Jun 11 08:52:36 CDT 2004


Paul Cowan wrote:

> If I have 2 tables say <table id=”table1”> and <table id=”table2”>.  How 
> can I through Javascript to combine all the rows from table1 into table2.

simplistic (assuming no THEAD, etc.) and untested :-)  --

   var firstTbody = document.getElementById('table1').firstChild;
   document.getElementById('table2').appendChild(firstTbody);

> Also can I tell whether a table has reached it’s overflow point or if a 
> table has it’s scrollbar showing, this if it has an overflow-y value of 
> ‘auto’.

The only thing that comes to mind is adding up the height of the
rows to see if the total exceeds the specified table height. But
I'm on my first cup of coffee...

Perhaps someone else will come up with something more elegant.

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the Javascript mailing list