dynamically resize layer height

T

Teelions

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>
 
J

Jeff North

| 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
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top