473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Some help with scrollTo please?

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!

Apr 24 '06 #1
5 1404
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

Apr 24 '06 #2
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!

ta******@mindspring.com wrote:
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


Apr 27 '06 #3
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!

ta******@mindspring.com wrote:
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


Apr 27 '06 #4
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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 27 '06 #5
ju*****@houston.rr.com wrote:
ta******@mindspring.com wrote:
It's almost certainly not universal, but I think you want to read
window.pageXOffset and window.pageYOffset. (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.

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

Apr 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: anna | last post by:
How to tell if a horizontal scrollbar is present? I only want to use scrollTo if horizontal scrollbar is present. window.scrollbars.visibility doesn't specify which scrollbar is present, so it...
1
by: heken | last post by:
I have this code embedded in a Firefox bookmark: javascript:Qr=document.getSelection();if(!Qr){void(Qr=prompt('Translate to...
18
by: ManWithNoName | last post by:
This is my first post, so be gentle. This: <body onload="window.scrollTo(x,y)"> Works fine. This:
3
by: ManWithNoName | last post by:
This is my second post, so please continue to be gentle. Is it possible to somehow scroll to a position in a layer? Something like document.getElementById('div').scrollTo(x,y) ? I have two...
1
by: redarko | last post by:
I have a set of imageButtons in my repeater that is in an update panel control. I would like to scroll up the page when the user clicks on one of these image (only in this case). I have tried...
3
bugboy
by: bugboy | last post by:
I need to be able to automatically scroll a div all the way to the right when new content is added to it via ajax. I've tried direction: rtl; which works in FF and IE but not Safari.. so i'm trying...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.