•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,534 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,968 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3562 | Replies: 2
![]() |
•
•
Join Date: Oct 2007
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 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;
}
<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;
}
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation:
Rep Power: 5
Solved Threads: 48
something like:
javascript Syntax (Toggle Plain Text)
<script type="text/javascript"> <!-- onload=function() { var divh = document.getElementById('pageContent').offsetHeight; var target = document.getElementById('flashOverlay'); target.style.height = ( divh + 460 ) + "px"; } //--> </script>
Plato forgot the nullahedron..
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Dynamic iframe height (JavaScript / DHTML / AJAX)
- I need to grab the height of a div. (JavaScript / DHTML / AJAX)
- Dynamic iFrame height, not working in ie without refresh. (JavaScript / DHTML / AJAX)
- dynamic row height (PHP)
- positioning a dynamic div to cover an existing table (HTML and CSS)
- Problem with <div> height - Controlling flow from center div (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: javascript - object required error
- Next Thread: how would this work?


Linear Mode