faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 34 people (32%) answered Yes
Recently 3 of 10 people (30%) answered Yes


How do I resize tables that may or may not be inside layers in NN4

Apr 6th, 2008 19:08
ha mo, Colin Fraser, Mark Szlazak,

The question is a little general, but the rules surrounding tables and
JavaScript are simple. You may note that there are all sorts of objects
in  JavaScript, but no table object. I have no idea why this is so, I
have never bothered to find out, but I suspect it lies at the heart of
most problems between tables and scripts. The only way I know to get
tables to behave themselves and act appropriately is to create the table
dynamically, that is in JavaScript. When the page is loaded the table is
created at that moment, it is not a static part of the page. 
For example : 
<script language="javascript">
document.write("<table width='100%'>")
document.write("<tr><td colspan=2><b>Popular Farnarkling Plays</td></tr>")
document.write("<tr><th>New Plays</th><th>Old Plays</th></tr>")
document.write("<tr><td>left Arkle</td><td>Blind side Farn</td></tr>")
Simple to do, but if you really want to be cute you can actually place
all table data in an array and use a FOR loop to do it all for you. On
big tables this saves a lot of time actually. 
However, the point is that the table becomes dynamic with the page so
when the page reloads, the table has no choice but to redraw itself, and
it does not matter whether the table is in a layer or not. 
Good luck.