Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Javascript to set div height based on _unused_ space
Old 09-26-2008, 05:25 PM Javascript to set div height based on _unused_ space
Experienced Talker

Posts: 40
Name: Kerrick
Trades: 0
I am relatively new at Javascript, so please bear with me. I'm trying to find out the height of space from the bottom of the outputted HTML from a PHP program, to the bottom of the viewport, and have Javascript set my next div height as that amount. Is this possible, assuming that the outputted HTML can vary from page load to page load, and even on one load due to a collapsible header?
__________________

Please login or register to view this content. Registration is FREE
Kerrick is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-26-2008, 06:18 PM Re: Javascript to set div height based on _unused_ space
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,526
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.webmaster-talk.com/javasc...avascript.html
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-26-2008, 06:25 PM Re: Javascript to set div height based on _unused_ space
Experienced Talker

Posts: 40
Name: Kerrick
Trades: 0
Believe it or not, I did look at that thread before posting this. However, I need something like this:

pseudo-code:
Code:
<html><head></head><body>
<div class="output">
lorem ipsum
</div>
<div id="frame">
my content here
</div>
</body></html>
Where the outputted content can be anything, and I'd need something like:
Code:
document.getElementById(DivID).style.height = document.getElementById(DivID).clientHeight - document.getElementByClass(output).style.height
__________________

Please login or register to view this content. Registration is FREE
Kerrick is offline
Reply With Quote
View Public Profile
 
Old 09-26-2008, 06:46 PM Re: Getting Div Height using JavaScript
Experienced Talker

Posts: 40
Name: Kerrick
Trades: 0
Nevermind, I found it. Here's the code, in case anybody wants to know.
Code:
      <iframe id="frame" style="width:100%;border:0;padding:0;margin:0;background:white;" src="http://www.webmaster-talk.com"></iframe>
	  <script type="text/javascript">
function resizeIframe() {
    var height = document.documentElement.clientHeight;
    height -= document.getElementById("frame").offsetTop;
    document.getElementById("frame").style.height = height +"px";
    
};
document.getElementById("frame").onload = resizeIframe;
window.onresize = resizeIframe;
</script>
__________________

Please login or register to view this content. Registration is FREE
Kerrick is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Javascript to set div height based on _unused_ space
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.36758 seconds with 12 queries