Size of Element

S

Steve

Is there a way to determine the height of a table. I have a table that is
built dynamically and contained in a div element. I want to be able to
position this div element based on the size of the table contained within
it.

<div id="div1"></div>

in my script I do something like this...

document.all[div1].innerHTML = '<table border="0" width="300"
cellspacing="0" cellpadding="0">' +
'<tr><td width="100%" bgcolor="#000000">' + tContent +
'</td></tr></table>'

tContent is a variable that can contain text that is chosen dynamically
based on user input. Basically what I want to do is determine the height of
the table so I can make sure the table is positioned so that it does not
display beyond the top or bottom edge of the page.

Thanks for any help...

Steve
 
M

Mosley Jones III

Steve said:
Is there a way to determine the height of a table. I have a table that is
built dynamically and contained in a div element. I want to be able to
position this div element based on the size of the table contained within
it.

<div id="div1"></div>

in my script I do something like this...

document.all[div1].innerHTML = '<table border="0" width="300"
cellspacing="0" cellpadding="0">' +
'<tr><td width="100%" bgcolor="#000000">' + tContent +
'</td></tr></table>'



function window_onload() {
x = mytab.offsetHeight
alert(x)
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top