Real Estate Forums
| Coding HTML, ASP, PHP, JAVA MYSQL and more. All coding questions should be asked here. |
![]() |
|
|
Thread Tools | Display Modes |
|
||||
|
lol
Last edited by Las Vegas : 05-12-2007 at 06:46 PM. |
|
|||
|
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> Code:
<script language="javascript">
function scrollToTop() {
scroll(0,0);
}
</script>
Tim |
|
||||
|
lol
Last edited by Las Vegas : 05-12-2007 at 06:46 PM. |
|
|||
|
Yea, I helped someone...and on my second post no less.
Glad I could help out... |
|
||||
|
lol
Last edited by Las Vegas : 05-12-2007 at 06:46 PM. |
|
|||
|
And my victory was short lived...
Can you direct me to an example of the non-working page? |
|
||||
|
lol
Last edited by Las Vegas : 05-12-2007 at 06:46 PM. |
|
||||
|
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
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>
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|