dynamically resize layer height

Discussion in 'Javascript' started by Teelions, Jan 22, 2007.

  1. Teelions

    Teelions Guest

    I know that this can be done for iframes but am wondering if it can be
    also done for layers.

    I have 2 pages: an asp content page that has a html (toc.html) include
    placed within it.

    The content of toc.html is a menu list placed inside a layer called
    "navcontainer". The content of the asp page is inside a layer named
    "wrapper". And the include file, toc.html, is inside a layer named
    "toc" inside "wrapper". So within the asp page, "navcontainer" is
    inside "toc" which is inside "wrapper".

    I want to dynamically resize the height of the menu list, on page load,
    to whatever the height is of the "wrapper" layer on each page. Wrapper
    will differ according to the amount of content on each page.

    I tried the following script inside both pages but it didn't work. I
    even substituted 'navcontainer' for 'toc' but still nothing. Any
    suggestions?

    ------------------------------------------
    <script type="text/JavaScript">
    function tocHeight() {
    if(document.getElementById) {
    h = document.getElementById('wrapper').offsetHeight;
    document.getElementById('navcontainer').style.height = h+"px";
    }
    else if(document.all) {
    h = document.window('wrapper').offsetHeight;
    document.all.navcontainer.style.height = h+"px";
    }
    }
    </script>
    Teelions, Jan 22, 2007
    #1
    1. Advertising

  2. Teelions

    Jeff North Guest

    On 22 Jan 2007 00:58:10 -0800, in comp.lang.javascript "Teelions"
    <>
    <> wrote:

    >| I know that this can be done for iframes but am wondering if it can be
    >| also done for layers.
    >|
    >| I have 2 pages: an asp content page that has a html (toc.html) include
    >| placed within it.
    >|
    >| The content of toc.html is a menu list placed inside a layer called
    >| "navcontainer". The content of the asp page is inside a layer named
    >| "wrapper". And the include file, toc.html, is inside a layer named
    >| "toc" inside "wrapper". So within the asp page, "navcontainer" is
    >| inside "toc" which is inside "wrapper".
    >|
    >| I want to dynamically resize the height of the menu list, on page load,
    >| to whatever the height is of the "wrapper" layer on each page. Wrapper
    >| will differ according to the amount of content on each page.
    >|
    >| I tried the following script inside both pages but it didn't work. I
    >| even substituted 'navcontainer' for 'toc' but still nothing. Any
    >| suggestions?
    >|
    >| ------------------------------------------
    >| <script type="text/JavaScript">
    >| function tocHeight() {
    >| if(document.getElementById) {
    >| h = document.getElementById('wrapper').offsetHeight;
    >| document.getElementById('navcontainer').style.height = h+"px";
    >| }
    >| else if(document.all) {
    >| h = document.window('wrapper').offsetHeight;
    >| document.all.navcontainer.style.height = h+"px";
    >| }
    >| }
    >| </script>


    First off, have you the height defined in an in-line style or css
    file/section? I've noticed that nothing works if it isn't defined.

    Secondly, why use javascript when css can handle this quite easily.
    http://css.maxdesign.com.au/floatutorial/tutorial0816.htm
    ---------------------------------------------------------------
    : Remove your pants to reply
    ---------------------------------------------------------------
    Jeff North, Jan 22, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YzY3NjIyOA==?=

    do it in database layer or application layer

    =?Utf-8?B?YzY3NjIyOA==?=, Jan 26, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    431
    Karl Seguin [MVP]
    Jan 27, 2006
  2. et
    Replies:
    2
    Views:
    1,907
  3. dan
    Replies:
    25
    Views:
    1,333
    Uncle Bob (Robert C. Martin)
    Oct 28, 2003
  4. Dhananjay
    Replies:
    1
    Views:
    1,108
    sloan
    Dec 18, 2006
  5. kingflux

    A way to dynamically resize the datagrid's frame height?

    kingflux, Apr 7, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    858
    kingflux
    Apr 7, 2007
Loading...

Share This Page