By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,935 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,935 IT Pros & Developers. It's quick & easy.

Resizing table depending on the windows size

P: n/a
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>
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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>
Jul 23 '05 #2

P: n/a
Java script Dude wrote:
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> ^^^^ _w=window
_d=document
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 ^^^^^^^^^^^^^^^^^^^ &&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>


Eeek. What a load of rubbish.

<http://pointedears.de/scripts/test/whatami>
PointedEars
--
C code. C code run. Run, code, run... PLEASE!!!
Jul 23 '05 #3

P: n/a
Thomas 'PointedEars' Lahn <Po*********@web.de> wrote in message news:<57****************@PointedEars.de>...
Java script Dude wrote:
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.

_w=window
_d=document


Huh?


`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).
<Code_Snippet>


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
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.