Resizing table depending on the windows size

Discussion in 'Javascript' started by Mario, Aug 31, 2004.

  1. Mario

    Mario Guest

    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>
     
    Mario, Aug 31, 2004
    #1
    1. Advertisements

  2. 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>
     
    Java script Dude, Sep 2, 2004
    #2
    1. Advertisements

  3. It dates back to the stone age, does it not?
    A "table" element does not have a "height" attribute (in Valid HTML).
    Never ever use tables for layout purposes alone.
    A table is a table is a table. [psf 3.8]
    Eeek. What a load of rubbish.

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


    PointedEars
     
    Thomas 'PointedEars' Lahn, Sep 4, 2004
    #3
  4. Posted this to the wrong node. This should be for Mario's post.

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

    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
     
    Java script Dude, Sep 7, 2004
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.