Real Estate Forums

Coding HTML, ASP, PHP, JAVA MYSQL and more. All coding questions should be asked here.

Reply
 
Thread Tools Display Modes
Old 07-22-2005, 07:34 PM
Las Vegas's Avatar
Las Vegas Las Vegas is offline
Advanced Webmaster
 
Join Date: Apr 2005
Posts: 165
Las Vegas is on a distinguished road
Question Weird IFrame Problem

lol

Last edited by Las Vegas : 05-12-2007 at 06:46 PM.
Reply With Quote
Old 07-22-2005, 09:32 PM
Coder_TimT Coder_TimT is offline
Real Estate Nu-bee
 
Join Date: Jul 2005
Posts: 4
Coder_TimT is on a distinguished road
Default Re: Weird IFrame Problem

This problem stems from the fact your iframe height is taller than the browser page height. In this case I assume the height is set so that the search page with it's large map can fit without displaying iframe scrollbars. So to view all of the iframe contents, the main page also has to be scrolled. Then when the iframe is reloaded on a submit , it only updates the iframe content, the main page and it's scrollbar position is unaffected.

What you can do to help your page out is to use a javascript handler function to scroll back up to the top whenever the iframe is reloaded. It ends up looking a bit strange because the scroll happens after the iframe is reloaded, but it's functional. I've never really used iframes much, so someone might can chime in with a better solution.

Anyway you'll want to do something like the following.

Add to your iframe tag:
Code:
<iframe name="iframe" onload="scrollToTop()" ...etc>
Then in the head section of the page:
Code:
<script language="javascript">
function scrollToTop() {
    scroll(0,0);
}
</script>
Hope that helps out some,
Tim
Reply With Quote
Old 07-22-2005, 09:42 PM
Las Vegas's Avatar
Las Vegas Las Vegas is offline
Advanced Webmaster
 
Join Date: Apr 2005
Posts: 165
Las Vegas is on a distinguished road
Default Re: Weird IFrame Problem

lol

Last edited by Las Vegas : 05-12-2007 at 06:46 PM.
Reply With Quote
Old 07-22-2005, 09:49 PM
Coder_TimT Coder_TimT is offline
Real Estate Nu-bee
 
Join Date: Jul 2005
Posts: 4
Coder_TimT is on a distinguished road
Default Re: Weird IFrame Problem

Yea, I helped someone...and on my second post no less.

Glad I could help out...
Reply With Quote
Old 07-22-2005, 10:00 PM
Las Vegas's Avatar
Las Vegas Las Vegas is offline
Advanced Webmaster
 
Join Date: Apr 2005
Posts: 165
Las Vegas is on a distinguished road
Question Re: Weird IFrame Problem

lol

Last edited by Las Vegas : 05-12-2007 at 06:46 PM.
Reply With Quote
Old 07-22-2005, 10:08 PM
Coder_TimT Coder_TimT is offline
Real Estate Nu-bee
 
Join Date: Jul 2005
Posts: 4
Coder_TimT is on a distinguished road
Default Re: Weird IFrame Problem

And my victory was short lived...

Can you direct me to an example of the non-working page?
Reply With Quote
Old 07-22-2005, 10:10 PM
Las Vegas's Avatar
Las Vegas Las Vegas is offline
Advanced Webmaster
 
Join Date: Apr 2005
Posts: 165
Las Vegas is on a distinguished road
Talking Re: Weird IFrame Problem

lol

Last edited by Las Vegas : 05-12-2007 at 06:46 PM.
Reply With Quote
Old 07-23-2005, 01:16 PM
sarahk's Avatar
sarahk sarahk is offline
Uber Real Estate Webmaster
 
Join Date: Jun 2004
Location: Auckland, New Zealand
Posts: 591
sarahk is on a distinguished road
Send a message via ICQ to sarahk Send a message via AIM to sarahk Send a message via Yahoo to sarahk
Default Re: Weird IFrame Problem

Hi

I've just been working on that very problem for a client and I'm using Mambo. They've got an onload script that sets the iframe height when the parent frame loads so I've got the iframe calling that when it reloads.

There are two problems
  • seems to flicker and cause problems for mac users (although this may be a red herring from another hack)
  • you don't have the ability to add code to the MLS page

but if it's any use here's the Mambo code (a little bit hacked). The first onload calls the iFrameHeight, you internal calls use iFrameWidth.
Code:
<script language="javascript" type="text/javascript">
				window.onload = iFrameWidth;
		
		function iFrameHeight() {
			var h = 0;
			if ( !document.all ) {
				h = document.getElementById('blockrandom').contentDocument.height;
				document.getElementById('blockrandom').style.height = h + 60 + 'px';
			} else if( document.all ) {
				h = document.frames('blockrandom').document.body.scrollHeight;
				document.all.blockrandom.style.height = h + 20 + 'px';
			}
		}
		function iFrameWidth() {
			var w = 0;
			if ( !document.all ) {
				w = document.width;
				document.getElementById('blockrandom').style.width = w - 165 - 15 + 'px';
			} else if( document.all ) {
				w = document.body.scrollWidth;
				document.all.blockrandom.style.width = w - 165 - 20 + 'px';
			}
		}
		</script>
Reply With Quote
Reply


Thread Tools
Display Modes

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

REW Conference

For our members

Main Sections

IDX Coverage Areas

Spiders Welcome

All times are GMT -7. The time now is 09:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.