|
Posted by Jonathan N. Little on 10/15/41 11:43
Chris Ianson wrote:
> "Neredbojias" <invalid@neredbojias.com> wrote in message
<snip>
> Your solution works great within the *one* iframe, but not when jumping to a
> different htm file within that one iframe.
>
> Here's what I've tried:
>
> Placed this after every jump tag:
>
> onClick="gett(this.href);return false;"
>
> Placed this in each of the 2 iframes:
>
> <script type="text/javascript">
> var pdbst;
> function gett(a) {
> pdbst=parent.document.body.scrollTop;
> location.replace(a);
> setTimeout("parent.scrollTo(0,pdbst)",1);
> }
> </script>
>
> When that didn't work I placed it in the master page, however that caused
> some sort of bug where there was a 15 second delay before it would call
> iframe htm #2, and in the meantime all the graphics stuck if you scrolled up
> and down the master page. :-S
>
> What would we need to change to get this great idea to work across pages?
> Thanks for your efforts, really appreciated.
Okay, one more time to demonstrate the JavaScript solution is possible
but a bit more complicated that you imagine.
1) Create a temp html page.
2) Add following JavaScript in the head:
<script type="text/javascript">
function stats(){
var f=document.forms[0];
f.wpyo.value=(window.pageYOffset ? window.pageYOffset : 'N/A');
if(typeof(document.body)!="undefined"){
f.db.value='YES';
f.dbst.value=(document.body.scrollTop ? document.body.scrollTop : 'N/A');
}
else{
f.db.value='NO';
f.dbst.value='N/A';
}
if(typeof(document.documentElement)!="undefined"){
f.dde.value='YES';
f.ddest.value=(document.documentElement.scrollTop ?
document.documentElement.scrollTop : 'N/A');
}
else{
f.dde.value='NO';
f.ddest.value='N/A';
}
}
function updater(){
setInterval("stats()", 200);
}
window.onload=updater;
</script>
3) Add several filler block elements so you can scroll the window a bit:
<p>Filler Paragraph</p>
4) About 1/2 way down put this form:
<form>
<div>window.pageYOffset? <input type="text" name="wpyo" size="20"</div>
<div>document.body? <input type="text" name="db" size="20"</div>
<div>document.body.scrollTop? <input type="text" name="dbst" size="20"</div>
<div>document.documentElement? <input type="text" name="dde" size="20"</div>
<div>document.documentElement.scrollTop? <input type="text" name="ddest"
size="20"</div>
</form>
5) Now the most important part, open and test in *more* than MSIE! This
will even display results for 4x browsers. Particularly notice the
difference among IE, Netscape 6+, Mozilla/Firefox, AND Opera, (hint, hint)
I am not saying it cannot be done, but it is not simple either. Almost
but not as bad as finding XY coordinates of mouse on an HTML document.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|