JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 8th, 2007, 09:34 PM
pebcak pebcak is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 1 pebcak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 52 sec
Reputation Power: 0
Need Help Debugging Script/Error in Script - Buggy Footer function setFooter(fid)

Can somebody help me debug this page. I'm a newbee to the forum. Thanks in advance.

Here is the footer that is offset within the window of the web page.
The page is a two column layout with CSS and JavaScript.
Each side needs to re-position each time window is resized.
I am pretty sure that it may be halfway finished, because the left side will work well.
But my problem is with the right side not dropping below the left
footer on a resize and keeping that pinned to the right.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        >

<html xmlns="" xml:lang="en" lang="en">
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		
<script type="text/javascript">
<!--
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setFooter(fid) {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('container').offsetHeight;  
			var footerElement = document.getElementById(fid);
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'absolute';
				footerElement.style.top = (windowHeight - footerHeight) + 'px';
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}
window.onload = function() {
  setFooter('footer');
}
window.onresize = function() {
  setFooter('footer');
}
//-->
</script>


<style tyle="text/css">
#header { margin: 0; padding: 0; }
h1 {
	width: 320px; height: 140px;
	margin: 0; padding: 0;
	border-left: 4px solid #000;
}
h2 { font-weight: normal; }
h3, h4 { margin: 0 0 0 17px; padding: 0 0 0 9px; font-size: 11px; }
h5 { margin: 0; padding: 17px 0 0 0; font-size: 26px; }
h6 { margin: 0; padding: 5px 0; line-height: 18px; }
#leftcontent {
	margin-right: 300px;
}
#rightcontent {
	margin: 0; padding: 0 25px 0 0; 
	top: 0; right: 0; 
	width: 250px; 
	position: absolute;
}
#content { margin: 0; padding: 40px 0; }
#content p {
	margin: 0; padding: 5px 0;
	font-size: 14px;
	font-family: serif;
	line-height: 18px;
}
#info {
	margin: 0; padding: 0 0 0 17px;
	border-left: 4px solid #000;
}
#date {
	font-size: 10px; 
	margin: 0 0 164px 0; padding: 17px; 
	height: 35px;
	border-left: 4px solid #000;
}
#side-info {
	font-size: 11px; 
	height: 315px;
	line-height: 14px;
	margin: 0; padding: 5px 17px;
	border-left: 4px solid #000;
}
a { text-decoration: none; font-weight: bold; }
#footer-left, #footer-right {
  font-size: 10px;
	color: #999;
	border-left: 1px dotted #CC9;
	border: 1px solid red;
}
#footer-left {
float:left;
	top: 0px;
	margin-left: 0px;
  width: 240px;
	padding: 10px 17px;
	background: green;
}
#footer-right {
	float:right;
	top: 0px;
	margin-right: 0px;
  width: 250px;
  padding: 10px 25px 10px 0px;
	background: blue;
}
#footer-right p {
	padding-left: 17px;
}
</style>
	</head>

	<body id="home">
	
	<!-- Start Container -->
    <div id="container">
    
    
		<!-- Start Left Content -->
		<div id="leftcontent">

			<!-- Start Header -->
			<div id="header"><h1>Header 1</h1></div>
			<!-- End Header -->

			<!-- Start Content -->
			<div id="content">
				<div id="info">
					<h5>page title</h5>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>					
				
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>					
				</div>
			</div>
			<!-- End Content -->
      
  		</div>
  		<!-- End Left Content -->
 
  
  		<!-- Start Right Content -->
  		<div id="rightcontent">
  			<div id="side-info">
          
					<h5>Side Title</h5>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>					
				
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>
					<p>The text contains The text contains The text contains The text contains The text contains The text contains The text contains</p>					
				
        </div>
        
  		</div>
  		<!-- End Right Content -->
  				
		</div><!-- End Container -->
    
    <!-- Start Footer -->
    <div id='footer'>
  		<div id="footer-left">
  			<p>© Footer Text Footer Text Footer Text Footer<br />Text Footer Text Footer Text Footer Text Footer Text </p>
  		</div>
  		
      <div id="footer-right">
			 <p>How do i get this line to<br />aligned with sidebar</p>
		  </div>
		  </div>
  		<!-- End Footer -->
  		
  	</body>
</html>

Reply With Quote
  #2  
Old September 24th, 2007, 01:08 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Is there a reason you're not just using percentages as your column widths?
You might save yourself all the Javascript trouble.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Need Help Debugging Script/Error in Script - Buggy Footer function setFooter(fid)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT