Click to See Complete Forum and Search --> : auto refresh page every 5 seconds


ThaSpY
12-30-2002, 01:19 AM
but its not that simple. i want to automatically refresh a page every 5 seconds. but, i want it to go to the bottom of that page each refresh. ive made the following tag at the bottom of the page:

<a name="bottom"></a>

now what javascript should i use to automatically refresh to the bottom every 5 seconds for an infimate amount of times.

thank you.

jschweed3
12-30-2002, 01:28 AM
I don't think I have time to write the script, but I can tell you what to do

you need to use a while loop, since you don't know any values
setTimeout would be used, and that means you would also use a function
window.open or something you would use, then the other stuff, I think

ThaSpY
12-30-2002, 01:32 AM
well, that doesnt really help me.. :( any1 else out there? maybe a link to something helpful, or some1 write a simple script to do it? thanks.

Charles
12-30-2002, 05:11 AM
<script type="text/javascript">
<!--
window.onload = function () {setTimeout ('window.location = "thisURL.html#bottom"', 18000000)};
// -->
</script>

ThaSpY
12-30-2002, 10:36 AM
Originally posted by Charles
<script type="text/javascript">
<!--
window.onload = function () {setTimeout ('window.location = "thisURL.html#bottom"', 18000000)};
// -->
</script>

that seems to work fine, but it only refree\shes the page once, and then never again. :( how do i fix this, ?

khalidali63
12-30-2002, 11:30 AM
did u think of using meta tag for refresh,
I found it the most efficient and Browser independent.

write this line in your html pages head section

<meta http-equiv="Refresh"
content="5">

And then write the following call in your onload function of javascript code block

location.href = "#bottom";


It will work

Cheers

Khalid

Charles
12-30-2002, 11:30 AM
Originally posted by ThaSpY
that seems to work fine, but it only refree\shes the page once, and then never again. :( how do i fix this, ? That's more than a little odd. For some reason your page must not be fully loading the second time or you have some other script that's throwing an error. Here's another, JavaScript free and therefore much better, method

<meta http-uquiv="Refresh" content="300;URL=thisURL.html#bottom">

ThaSpY
12-30-2002, 12:02 PM
That was my original approach. It refreshed fine, but after the second refresh, it would not read the #bottom, therefore refreshing to the top of the page again.

ThaSpY
12-30-2002, 12:04 PM
Originally posted by khalidali63
did u think of using meta tag for refresh,
I found it the most efficient and Browser independent.

write this line in your html pages head section

<meta http-equiv="Refresh"
content="5">

And then write the following call in your onload function of javascript code block

location.href = "#bottom";


It will work

Cheers

Khalid

sorry, i never saw your post. do u mean after i put the meta tag in, write:
<script language="javasript">
location.href = "#bottom";
</script>

that doesnt look right, what did u mean?

khalidali63
12-30-2002, 12:05 PM
There must be some other part of the code that is causing the problem,I have meta tag code in a test page and its beein going for last 30 mins..lol

post a link here to ur page that is causing problems...

Khalid

ThaSpY
12-30-2002, 12:32 PM
this isnt the exact page, but a simpler one with my problem still persisting. Ive set it to refesh everysecond to #bottom.

http://www.members.shaw.ca/spyfart/refresh.html

khalidali63
12-30-2002, 12:52 PM
Here is the modified code from the link you provided

it is attached as a text file.
Save it as html file and take a look

jdavia
12-30-2002, 02:18 PM
This works even in older browsers

<META HTTP-EQUIV="Refresh" CONTENT="1;URL=YOURPAGE.html#bottom">

No need for any other code at the bottom of the page to make it open there.

ThaSpY
12-30-2002, 02:59 PM
Originally posted by khalidali63
Here is the modified code from the link you provided

it is attached as a text file.
Save it as html file and take a look


thank you thank you sooo much, i ahve been looking all over for a solution :)

here is the final result: www.thaspy.2ya.com