Resizing table depending on the windows size

M

Mario

i have three rows on my main site
i want that the middle-row resizes (only height) depending on the windows
size
i know it is possible in javascript, but i dont know how ot do it
im more like server-side scripting type of guy




<table align="center" width="100%" height="100%"><tr align="center"
valign="middle"><td>

<table width="750" align="center" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td height="50" align="center" valign="top">
<!-- TOP -->
</td>
</tr>

<tr>
<td height=" <!-- RESIZE THIS DEPENDING ON THE WINDOWS SIZE -->
" align="center" valign="top">
<!-- CONTENT -->
</td>
</tr>

<tr>
<td height="50" align="center" valign="bottom">
<!-- BOTTOM -->
</td>
</tr>
</table>

</td></tr></table>
 
J

Java script Dude

Here is my hack from a year or so back with a similar problem but I
was sizing iFrames.

JsD


<body>
<table align="center" width="100%" height="100%"><tr align="center"
valign="middle"><td>

<table width="750" align="center" border="1" cellpadding="0"
cellspacing="0">
<tr>
<td height="50" align="center" valign="top">
top
</td>
</tr>

<tr>
<td id=tdMiddle height=100% align="center" valign="top">
middle
</td>
</tr>

<tr>
<td height="50" align="center" valign="bottom">
bottom
</td>
</tr>
</table>



</td></tr></table>

<script>
_w=window
_d=document
// General Utility Functions
function winWidth(){return is.ie?_d.body.clientWidth:_w.innerWidth}
function winHeight(){return is.ie?_d.body.clientHeight:_w.innerHeight}
function ClientSniffer(){//IE5.5+&Mozilla 5+
var t=this, n=navigator,sUA=n.userAgent.toLowerCase(),i
t.ie=false;t.moz=false
if(
(i=sUA.indexOf('msie'))>-1
&&parseFloat(sUA.substring(i+5,sUA.length))>=5.5
){
t.ie=true
}else{
if(sUA.indexOf('gecko')!=-1
&&parseInt(n.appVersion
)>=5){
t.moz=true
}
}
}; _w.is=new ClientSniffer()


oTD=_d.getElementById("tdMiddle")
function setIFSize(){
oTD.style.height=winHeight()-100-30
}

_w.onresize=setIFSize
setIFSize()
</script>
</body>
 
T

Thomas 'PointedEars' Lahn

Java said:
Here is my hack from a year or so back

It dates back to the stone age, does it not?
[...]
<body>
<table align="center" width="100%" height="100%"><tr align="center"
valign="middle">

A "table" element does not have a "height" attribute (in Valid HTML).
<td>

<table width="750" align="center" border="1" cellpadding="0"
cellspacing="0">
<tr>
<td height="50" align="center" valign="top">
top
</td>
</tr>

<tr>
<td id=tdMiddle height=100% align="center" valign="top">
middle
</td>
</tr>

<tr>
<td height="50" align="center" valign="bottom">
bottom
</td>
</tr>
</table>

</td></tr></table>

Never ever use tables for layout purposes alone.
A table is a table is a table. [psf 3.8]
<script> ^^^^

Huh?

// General Utility Functions
function winWidth(){return is.ie?_d.body.clientWidth:_w.innerWidth} ^^^^^
function winHeight(){return is.ie?_d.body.clientHeight:_w.innerHeight} ^^^^^
function ClientSniffer(){//IE5.5+&Mozilla 5+
var t=this, n=navigator,sUA=n.userAgent.toLowerCase(),i
t.ie=false;t.moz=false
if(
(i=sUA.indexOf('msie'))>-1 ^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^
t.moz=true
}
}
}; _w.is=new ClientSniffer()


oTD=_d.getElementById("tdMiddle") ^^^^^^^^^^^^^^^^^
function setIFSize(){
oTD.style.height=winHeight()-100-30
}

_w.onresize=setIFSize
setIFSize()
</script>
</body>

Eeek. What a load of rubbish.

<http://pointedears.de/scripts/test/whatami>


PointedEars
 
J

Java script Dude

Thomas 'PointedEars' Lahn said:
Java said:
Here is my hack from a year or so back

It dates back to the stone age, does it not?

:]


<Code_Snippet>

A "table" element does not have a "height" attribute (in Valid HTML).

Posted this to the wrong node. This should be for Mario's post.

<Code_Snippet>

Never ever use tables for layout purposes alone.
A table is a table is a table. [psf 3.8]

Same again consistency is a good trait for programmers.


`window` and `document` are the most commonly used instance variables
and as such, shortening their name will save char space in js sources,
which in any script language is a good thing. I borrowed this
methodology from a very good but now invisible js programmer - Stereo
Frog (www.stereofrog.com).
Eeek. What a load of rubbish.


Dude, this code was copied and pasted from some abstracted js
libraries. Unfortunately I did not have time to clean it up for the
copy and paste programmers around. BTW - Any decent hacker should be
able to reverse engineer and use.

JsD
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top