Resizing table depending on the windows size

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mario

    Resizing table depending on the windows size

    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>


  • Java  script  Dude

    #2
    Re: Resizing table depending on the windows size

    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(){retu rn is.ie?_d.body.c lientWidth:_w.i nnerWidth}
    function winHeight(){ret urn is.ie?_d.body.c lientHeight:_w. innerHeight}
    function ClientSniffer() {//IE5.5+&Mozilla 5+
    var t=this, n=navigator,sUA =n.userAgent.to LowerCase(),i
    t.ie=false;t.mo z=false
    if(
    (i=sUA.indexOf( 'msie'))>-1
    &&parseFloat(sU A.substring(i+5 ,sUA.length))>= 5.5
    ){
    t.ie=true
    }else{
    if(sUA.indexOf( 'gecko')!=-1
    &&parseInt(n.ap pVersion
    )>=5){
    t.moz=true
    }
    }
    }; _w.is=new ClientSniffer()


    oTD=_d.getEleme ntById("tdMiddl e")
    function setIFSize(){
    oTD.style.heigh t=winHeight()-100-30
    }

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

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Resizing table depending on the windows size

      Java script Dude wrote:
      [color=blue]
      > Here is my hack from a year or so back[/color]

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

      A "table" element does not have a "height" attribute (in Valid HTML).
      [color=blue]
      > <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>[/color]

      Never ever use tables for layout purposes alone.
      A table is a table is a table. [psf 3.8]
      [color=blue]
      > <script>[/color]
      ^^^^[color=blue]
      > _w=window
      > _d=document[/color]

      Huh?
      [color=blue]
      > // General Utility Functions
      > function winWidth(){retu rn is.ie?_d.body.c lientWidth:_w.i nnerWidth}[/color]
      ^^^^^[color=blue]
      > function winHeight(){ret urn is.ie?_d.body.c lientHeight:_w. innerHeight}[/color]
      ^^^^^[color=blue]
      > function ClientSniffer() {//IE5.5+&Mozilla 5+
      > var t=this, n=navigator,sUA =n.userAgent.to LowerCase(),i
      > t.ie=false;t.mo z=false
      > if(
      > (i=sUA.indexOf( 'msie'))>-1[/color]
      ^^^^^^^^^^^^^^^ ^^^^[color=blue]
      > &&parseFloat(sU A.substring(i+5 ,sUA.length))>= 5.5[/color]
      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^[color=blue]
      > ){
      > t.ie=true
      > }else{
      > if(sUA.indexOf( 'gecko')!=-1[/color]
      ^^^^^^^^^^^^^^^ ^^^^^^^^^[color=blue]
      > &&parseInt(n.ap pVersion
      > )>=5){[/color]
      ^^^^^^^^^^^^^^^ ^^^^^^^^[color=blue]
      > t.moz=true
      > }
      > }
      > }; _w.is=new ClientSniffer()
      >
      >
      > oTD=_d.getEleme ntById("tdMiddl e")[/color]
      ^^^^^^^^^^^^^^^ ^^[color=blue]
      > function setIFSize(){
      > oTD.style.heigh t=winHeight()-100-30
      > }
      >
      > _w.onresize=set IFSize
      > setIFSize()
      > </script>
      > </body>[/color]

      Eeek. What a load of rubbish.

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


      PointedEars
      --
      C code. C code run. Run, code, run... PLEASE!!!

      Comment

      • Java  script  Dude

        #4
        Re: Resizing table depending on the windows size

        Thomas 'PointedEars' Lahn <PointedEars@we b.de> wrote in message news:<5791085.g Zse1U3mzW@Point edEars.de>...[color=blue]
        > Java script Dude wrote:
        >[color=green]
        > > Here is my hack from a year or so back[/color]
        >
        > It dates back to the stone age, does it not?
        >[/color]

        :]


        [color=blue][color=green]
        > > <Code_Snippet >[/color]
        >
        > A "table" element does not have a "height" attribute (in Valid HTML).[/color]

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

        [color=blue][color=green]
        > > <Code_Snippet >[/color]
        >
        > Never ever use tables for layout purposes alone.
        > A table is a table is a table. [psf 3.8]
        >[/color]

        Same again consistency is a good trait for programmers.

        [color=blue][color=green]
        > > _w=window
        > > _d=document[/color]
        >
        > Huh?[/color]

        `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).
        [color=blue][color=green]
        > > <Code_Snippet >[/color]
        >
        > Eeek. What a load of rubbish.[/color]


        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

        Comment

        Working...