[Javascript] Combining 2 tables

Gee, David dgee at freemarkets.com
Fri Jun 11 09:21:49 CDT 2004



-----Original Message-----
From: Paul Cowan [mailto:dagda1 at hotmail.com] 
Sent: Friday, June 11, 2004 8:31 AM
To: javascript at LaTech.edu
Subject: [Javascript] Combining 2 tables


Hi,

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.

The "evil" way (assumes you're not using thead, tbody, or tfoot):

 var tbl1 = document.getElementById("table1Id");
 var tbl2 = document.getElementById("table2Id");
 tbl1.innerHTML += tbl2.innerHTML;

I can hear the boos already :) Actually, this may not even work, I seem
to remember some weird effects when using innerHTML and tables.


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'.

I think comparing scrollHeight to offsetHeight might work, but I'm not
sure.

David


Thanks in advance.

Paul


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list