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:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old November 4th, 2005, 12:16 PM
wyclef wyclef is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 8 wyclef User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 16 sec
Reputation Power: 0
Conflicting Javascripts - Help Please

Hi, i've got 2 scripts that work perfectly fine independently but when you merge them together Mac IE 5.2.3 does not like. Something about the Toggle Object changing the height of the layout and interacting with the Center Object does not mesh well together for Mac IE 5.2.3. onResize everything is fine so I'm thinking if there is a clever way to utilize the setContent(); function after onClick or something that would probably do the trick. But let me know if you notice anything that stands out. Thanks.

Code:
/*--------------------------------------------------
	Center Object
--------------------------------------------------*/
<!--
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 setContent() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentElement = document.getElementById('content');
			//var contentHeight = contentElement.offsetHeight;
			var contentHeight =
				document.getElementById('header').offsetHeight +
				document.getElementById('info').offsetHeight +
				document.getElementById('footer').offsetHeight; 
			if (windowHeight - contentHeight > 0) {
				contentElement.style.position = 'relative';
				contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
			
			//rules for IE Mac
				
			if(navigator.appVersion.indexOf("MSIE") != -1){var IE = true}else{ var IE = false;}
			if(navigator.appVersion.toLowerCase().indexOf("mac") != -1){var Mac = true}else{ var Mac = false;}
			
			if(Mac && IE) {
				//get the height of header
				var headH = document.getElementById('header').offsetHeight;
				//set position of INFO based on that height
				document.getElementById('info').style.position = 'absolute';
				document.getElementById('info').style.top = headH +'px';
			
				//get the height of INFO
				var infoH = document.getElementById('info').offsetHeight;
				//set position of Footer based on that height
				document.getElementById('footer').style.position = 'absolute';
				document.getElementById('footer').style.top = (infoH + headH)  +'px';
			}
			}
			else {
				contentElement.style.position = 'static';
			}
		}
	}
}
/*--------------------------------------------------
	Toggle Object
--------------------------------------------------*/
<!--
init = function () {
	var table = document.getElementsByTagName("table");
	for (var i=0; i<20; i++) {
		var caption = table[i].getElementsByTagName("caption");
		caption[0].thead = table[i].getElementsByTagName("thead");
		caption[0].tbody = table[i].getElementsByTagName("tbody");
		// hide thead and tbody
		caption[0].thead[0].style.display = 'table-header-group';
		caption[0].tbody[0].style.display = 'table-header-group';
		caption[0].onclick = function () {
			this.thead[0].style.display = this.thead[0].style.display == 'none' ? '' : 'none';
			this.tbody[0].style.display = this.tbody[0].style.display == 'none' ? '' : 'none';
			setContent();
		} 
	}
}
window.onload = function() {
	init();
	setContent();
}
window.onresize = function() {
	setContent();
}
//-->

Reply With Quote
  #2  
Old June 30th, 2006, 04:43 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 9 m 44 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
what error message are you getting, line exc. plz list that eather on a post or in a txt file, and zip me the files, ill take a look at it

colton22

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Conflicting Javascripts - Help Please


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 5 hosted by Hostway