Click to See Complete Forum and Search --> : Table


Ridlr
01-10-2003, 05:40 AM
I got a javascript that reads the height and width of a frame.
I want to give the table the same height and width, but i can't get it to work. :(

This is my javascript:

function FrameHeight()
{
if (document.layers) {
height = window.innerHeight;
}
else if (document.all) {
height = document.body.clientHeight;
}
}

function FrameWidth()
{
if (document.layers) {
width = window.innerWidth;
}
else if (document.all) {
width = document.body.clientWidth;
}
}

And here is my table:

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" HEIGHT="FrameHeight()" WIDTH="FrameWidth()">
<TR>
<TD ALIGN="center" VALIGN="middle" STYLE="border-top: 1 solid #000000; border-bottom: 1 solid #000000"><IMG SRC="gfx/uc.jpg" BORDER="0" WIDTH="600" HEIGHT="200" ALIGN="bottom"></TD>
</TR>
</TABLE>



Can someone please help me. I know my javascript are working.

gil davis
01-10-2003, 05:51 AM
It would be nice if it were that easy.

Use a script to create the table tag:

<script type="text/javascript" language="JavaScript">
document.write('<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" HEIGHT="' + FrameHeight() + '" WIDTH="' + FrameWidth() + '">');
</script>
<noscript><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" HEIGHT="100%" WIDTH="100%"></noscript>

followed by the rest of the table.

Nicodemas
01-10-2003, 06:02 AM
Write your table like so....substituting this code for your table code.


<script>
document.writeln("<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" HEIGHT=\"" + height + "\" WIDTH=+"" + width + "\">")
document.writeln("<TR>")
document.writeln("<TD ALIGN=\"center\" VALIGN=\"middle\" STYLE=\"border-top: 1 solid #000000; border-bottom: 1 solid #000000\"><IMG SRC=\"gfx/uc.jpg\" BORDER=\"0\" WIDTH=\"600\" HEIGHT=\"200\" ALIGN=\"bottom\"></TD>")
document.writeln("</TR>")
document.writeln("</TABLE>")
</script>

Ridlr
01-10-2003, 06:46 AM
Thanks all for the help :D