/    Sign up×
Community /Pin to ProfileBookmark

auto refresh page every 5 seconds

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.

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@jschweed3Dec 30.2002 — 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
Copy linkTweet thisAlerts:
@ThaSpYauthorDec 30.2002 — 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.
Copy linkTweet thisAlerts:
@CharlesDec 30.2002 — [font=monospace]<script type="text/javascript">

<!--

window.onload = function () {setTimeout ('window.location = "[i]thisURL.html[/i]#bottom"', 18000000)};

// -->

</script>[/font]
Copy linkTweet thisAlerts:
@ThaSpYauthorDec 30.2002 — [i]Originally posted by Charles [/i]

[B][font=monospace]<script type="text/javascript">

<!--

window.onload = function () {setTimeout ('window.location = "[i]thisURL.html[/i]#bottom"', 18000000)};

// -->

</script>[/font] [/B]
[/QUOTE]


that seems to work fine, but it only refreeshes the page once, and then never again. ? how do i fix this, ?
Copy linkTweet thisAlerts:
@khalidali63Dec 30.2002 — 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
Copy linkTweet thisAlerts:
@CharlesDec 30.2002 — [i]Originally posted by ThaSpY [/i]

[B]that seems to work fine, but it only refreeshes the page once, and then never again. ? how do i fix this, ? [/B][/QUOTE]
[font=georgia]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[/font]

[font=monospace]

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

[/font]
Copy linkTweet thisAlerts:
@ThaSpYauthorDec 30.2002 — 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.
Copy linkTweet thisAlerts:
@ThaSpYauthorDec 30.2002 — [i]Originally posted by khalidali63 [/i]

[B]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 [/B]
[/QUOTE]


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?
Copy linkTweet thisAlerts:
@khalidali63Dec 30.2002 — 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
Copy linkTweet thisAlerts:
@ThaSpYauthorDec 30.2002 — 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
Copy linkTweet thisAlerts:
@khalidali63Dec 30.2002 — 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

[upl-file uuid=ebd7ef72-61ff-4887-8a60-c2a059703d87 size=2kB]refreshbottompage.txt[/upl-file]
Copy linkTweet thisAlerts:
@jdaviaDec 30.2002 — 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.
Copy linkTweet thisAlerts:
@ThaSpYauthorDec 30.2002 — [i]Originally posted by khalidali63 [/i]

[B]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 [/B]
[/QUOTE]



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

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

Success!

Help @ThaSpY spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...