Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / April 2006



Tip: Looking for answers? Try searching our database.

Some help with scrollTo please?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
junk419@houston.rr.com - 24 Apr 2006 17:43 GMT
Hi all.  First of all I know pretty much nothing about Javascript :)
It's just that I found a program/script that will refresh a webpage
(not mine) every so often.  It's called AllStock's AutoRefresh.  What I
am hoping some can help me with is for when it refreshes I would like
for it to scroll down about 3 or 4 clicks OR I can scroll it down my
self but when it refreshes it goes down to the point I was at.  Either
is really fine with me.  Here's what I have in the refresh.htm code:

var cycle=1;
sites=["http://www.thesite.com"];
sites_upper=1;
delay=.5*60000;
function
reload_page(){parent.frames[0].location=sites[cycle];if(cycle==sites_upper)cycle=0;else
++cycle;}</SCRIPT><body
onLoad="parent.frames[0].location=sites[0];window.setInterval('reload_page()',delay)"></body></html>

This is what is in the index.htm code in case you'd need to look at
that too:

<html><frameset rows=*,0 border=0 frameborder=0 framespacing=0><frame
name="clientarea" border=no framespacing=0 noresize><frame
src="refresh.htm" name="refresher" border=no framespacing=0
noresize></frameset></html>

Thanks in advance for any help you might be able to give me!
taoberly@mindspring.com - 24 Apr 2006 22:21 GMT
It's almost certainly not universal, but I think you want to read
window.pageXOffset and window.pageXOffset.  (At least
Netscape-compatible browsers will support this.)  So as the first line
of the reload_page() function, I would add

x = window.pageXOffset;
y = window.pageYOffset;

and then as the last line, add

window.scrollTo(x,y);

Something like that.  Without seeing it in action, this may not be 100%
correct, but it's close.

Good luck,

Todd
junk419@houston.rr.com - 27 Apr 2006 14:36 GMT
Well, like I said above, I am not at all familiar with javascript and
how it all goes etc.  I'd really appreciate it if someone could show me
exactly where it goes.  I've tried looking up examples but everyone's
seems to be a little different.  Also do I need to substitute x & y
with numbers and if so which ones?

Thanks!

> It's almost certainly not universal, but I think you want to read
> window.pageXOffset and window.pageXOffset.  (At least
[quoted text clipped - 14 lines]
>
> Todd
Evertjan. - 27 Apr 2006 14:52 GMT
wrote on 27 apr 2006 in comp.lang.javascript:

> Well, like I said above, [..]

"Above"? As you so comprehensively demonstrate
by writing this on the first line of your posting:

please do not toppost on usenet.

===============

[topposting corrected]

>> x = window.pageXOffset;
>> y = window.pageYOffset;
>>
>> and then as the last line, add
>>
>> window.scrollTo(x,y);

> Well, like I said above, I am not at all familiar with javascript and
> how it all goes etc.  I'd really appreciate it if someone could show me
> exactly where it goes.  I've tried looking up examples but everyone's
> seems to be a little different.  Also do I need to substitute x & y
> with numbers and if so which ones?

The x and y variables must be filled with the values of your scroll
destination.

So if you want to record the present position for a LATER(!) vertical
scroll:

x = 0;
y = window.pageYOffset;

will do that for you on some browsers.

window.scrollTo(x,y);

called by user or timer action,
will do the actual scrolling,
when you want to get BACK(!!!) to that previous recorded position.

=================

Programming such scrolling is IMHO not for the beginning js programmer,
better first do some simple projects to learn,
... or source it out as a payed project, if it is worth it.

Signature

Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

junk419@houston.rr.com - 27 Apr 2006 14:48 GMT
Well, like I said above, I am not at all familiar with javascript and
how it all goes etc.  I'd really appreciate it if someone could show me
exactly where it goes.  I've tried looking up examples but everyone's
seems to be a little different.  Also do I need to substitute x & y
with numbers and if so which ones?

Thanks!

> It's almost certainly not universal, but I think you want to read
> window.pageXOffset and window.pageXOffset.  (At least
[quoted text clipped - 14 lines]
>
> Todd
taoberly@mindspring.com - 30 Apr 2006 01:21 GMT
> > It's almost certainly not universal, but I think you want to read
> > window.pageXOffset and window.pageYOffset.  (At least
[quoted text clipped - 10 lines]
> > Something like that.  Without seeing it in action, this may not be 100%
> > correct, but it's close.

> Well, like I said above, I am not at all familiar with javascript and
> how it all goes etc.  I'd really appreciate it if someone could show me
> exactly where it goes.  I've tried looking up examples but everyone's
> seems to be a little different.  Also do I need to substitute x & y
> with numbers and if so which ones?

If you're still confused, email me the code privately.  It's a simple
thing, but I can't say something will work 100% unless I try it myself.

Todd
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.