0

I need to be able to dynamically assign a variable to the height attribute of a div(flashOverlay) based on the height and t position of another div(pageContent). I am using the following script to capture the variable data. How do I apply this var to the div?

<script type="text/javascript">
<!--
onload=function() {

var divh = document.getElementById('pageContent').offsetHeight;

     alert(divh +460+"px");

 }
//-->
</script>

The div I also has the following style applied using external CSS file

#flashOverlay{
    TOP: 0px;
    LEFT: 0px;
    POSITION: absolute;
    Z-INDEX: 20;
    visibility: visible;
    overflow: auto;
    margin: 0px;
    width: 100%;
    padding: 0px;
    vertical-align: top;
    height: 1054px;
}

Edited by mike_2000_17: Fixed formatting

3
Contributors
3
Replies
5
Views
10 Years
Discussion Span
Last Post by Ashriya
0

something like:

<script type="text/javascript">
<!--
onload=function() {

var divh = document.getElementById('pageContent').offsetHeight;
var target = document.getElementById('flashOverlay');
target.style.height = ( divh + 460 ) + "px";
}
//-->
</script>
0

Hi All,
Neither of the properties clientHeight and offsetHeight has worked out for me while I try to determine the height of the div created dynamically. Could someone suggest alternative please? Thanks a ton in advance.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.