Solved

Looping problem in IE7

Posted on 2006-11-26
6
761 Views
Last Modified: 2008-05-13
The following function works perfectly in Firefox but in IE7 it loops. How can I stop the loop in IE7 and achieve the effect I need?

I would suggest that you open the page in Firefox because it will eventually crash IE. You can use the IE tab switch plugin in Firefox to view the page and it will be easier to switch back to Firefox rather than viewing in a standalone IE.
example URL: http://eyecreate.ods.org/eyecreate/

function findWindowDim(){
/*Constructing the function to work with Netscape 6 (innerHeight)
and Netscape 7+, Mozilla 1.0.1+ and IE6+ (clientHeight).*/

//Determining browser type by functionality.
//Start IE5+, NS7 and Mozilla based on build 1.0.1
//var objCenter = document.getElementById('centercolumn')

var leftHeight = document.getElementById('leftcolumn').offsetHeight;
var rightHeight = document.getElementById('rightcolumn').offsetHeight;
var mastheadHeight = document.getElementById('masthead').offsetHeight;
var centerHeight = document.getElementById('centercolumn').offsetHeight;
var containerHeight = document.getElementById('container').offsetHeight;

var objFooter = document.getElementById('footer')
var objLeft = document.getElementById('leftcolumn')
var objRight = document.getElementById('rightcolumn')
var objCenter = document.getElementById('centercolumn')
var objContainer = document.getElementById('container')

if ((centerHeight > leftHeight) && (centerHeight > rightHeight)) {
footerTop = mastheadHeight + centerHeight;
footerTopPx = footerTop+"px"
objFooter.style.top = footerTopPx

colHeight = centerHeight + 3;
Height = colHeight+"px"
objRight.style.height = Height;

CentercolHeight = centerHeight - 15;
CenterCol = CentercolHeight+"px"
objCenter.style.height = CenterCol;
objLeft.style.height = Height;
objRight.style.height = Height;
objContainer.style.height = footerTopPx;
} else if ((rightHeight > leftHeight) && (rightHeight > centerHeight)) {
// If the right column is longer than the centre and left columns
footerTop = mastheadHeight + rightHeight;
footerTopPx = footerTop+"px"
objFooter.style.top = footerTopPx

colHeight = rightHeight;
rHeight = colHeight+"px"
objLeft.style.height = rHeight;

CentercolHeight = rightHeight - 15;
CenterCol = CentercolHeight+"px"
objCenter.style.height = CenterCol;
objContainer.style.height = footerTopPx;
} else if ((leftHeight > centerHeight) && (leftHeight > rightHeight)) {
// If the left column is longer than the centre and right columns
footerTop = mastheadHeight + leftHeight;
footerTopPx = footerTop+"px"
objFooter.style.top = footerTopPx

colHeight = leftHeight;
lHeight = colHeight+"px"
objRight.style.height = lHeight;

CentercolHeight = leftHeight - 15;
CenterCol = CentercolHeight+"px"
objCenter.style.height = CenterCol;
objContainer.style.height = footerTopPx;
} else {
// If left and right columns are shorter than the centre column
footerTop = mastheadHeight + centerHeight + 6;
footerTopPx = footerTop+"px"
objFooter.style.top = footerTopPx

CenterCol = centerHeight+"px"
objLeft.style.height = CenterCol;
objRight.style.height = CenterCol;
objContainer.style.height = footerTopPx;
      }
}
0
Comment
Question by:frankenstrat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 9

Expert Comment

by:alkisg
ID: 18015125
Without reading much of your code, I assume the problem is this line:
  window.onresize = findWindowDim;

Inside findWindowDim, you do something that triggers window.onresize again, so it loops.

A possible solution: put
  window.onresize = null
as the fist line of findWindowDim, and
  window.onresize = findWindowDim
as the last line.

Again, I maybe wrong in this, I didn't have time to read your code extensively...
0
 

Author Comment

by:frankenstrat
ID: 18015154
Thanks for the try but that didn't work.
0
 

Author Comment

by:frankenstrat
ID: 18022410
Problem has been resolved. The padding in the style sheet was different for each layer which produced erratic results.
0
 
LVL 9

Expert Comment

by:alkisg
ID: 18022458
*Just out of curiosity*, did you isolate which padding in the CSS caused IE to freeze?
Can you reproduce it with minimal code?
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18217732
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Echo'd values in dropdowns 6 57
Add Rows on a Table 8 54
JSON help 8 48
How to send a javascript array via AJAX (jquery)? 3 43
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question