User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Oct 2007
Posts: 6
Reputation: buggsword is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
buggsword buggsword is offline Offline
Newbie Poster

Dynamic Div Height

  #1  
Oct 5th, 2007
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;
}
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 48
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: Dynamic Div Height

  #2  
Oct 5th, 2007
something like:
  1. <script type="text/javascript">
  2. <!--
  3. onload=function() {
  4.  
  5. var divh = document.getElementById('pageContent').offsetHeight;
  6. var target = document.getElementById('flashOverlay');
  7. target.style.height = ( divh + 460 ) + "px";
  8. }
  9. //-->
  10. </script>
Plato forgot the nullahedron..
Reply With Quote  
Join Date: Oct 2007
Posts: 6
Reputation: buggsword is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
buggsword buggsword is offline Offline
Newbie Poster

Re: Dynamic Div Height

  #3  
Oct 6th, 2007
Worked a treat - thank you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:40 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC