School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,444 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,528 people online right now. Registration is fast and FREE... Join Now!




header(Refresh...) question

 

header(Refresh...) question

DecafJava

28 Jun, 2009 - 01:33 AM
Post #1

New D.I.C Head
*

Joined: 18 May, 2009
Posts: 47


My Contributions
I currently have the code:

CODE

header(Refresh: 5; url=www.yahoo.com);


I was wondering...is there a way to have it display the actual seconds remaining before it does the redirect...something like:

You will be redirected to Yahoo! in 5 seconds.

...then have it keep on updating the time, to like:

You will be redirected to Yahoo! in 4 seconds.

...etc

If so, how? I tried Google and the search option in this forum, yet no matches found.

User is offlineProfile CardPM
+Quote Post


no2pencil

RE: Header(Refresh...) Question

28 Jun, 2009 - 01:36 AM
Post #2

i R L33t Skiddie, k?
Group Icon

Joined: 10 May, 2007
Posts: 13,233



Thanked: 289 times
Dream Kudos: 2875
Expert In: Goofing Off

My Contributions
You could use an animated gif.
User is online!Profile CardPM
+Quote Post

noorahmad

RE: Header(Refresh...) Question

28 Jun, 2009 - 01:59 AM
Post #3

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
Here is the Code
HTML
<input id="Timer" readonly type="text">
<script>
var timer = document.getElementById('Timer');
timer.value=5;
var seconds = 0;
var minutes = 5;
function con()
{
if(minutes<-1)
{
window.location="yahoo.com";
}
seconds ++;
if(seconds==50)
{
timer.value = minutes;
minutes -=1;
seconds = 0;
}
setTimeout("con()",10);

}
con();
</script>


And Let to Know if it Helps smile.gif
User is online!Profile CardPM
+Quote Post

firebolt

RE: Header(Refresh...) Question

29 Jun, 2009 - 05:04 AM
Post #4

D.I.C Lover
Group Icon

Joined: 20 Feb, 2009
Posts: 5,463



Thanked: 75 times
Dream Kudos: 1675
My Contributions
Instead of window.location="yahoo.com", use url="www.yahoo.com" or similar, so it redirects to an actual site, not a containing folder etc smile.gif
User is offlineProfile CardPM
+Quote Post

DecafJava

RE: Header(Refresh...) Question

29 Jun, 2009 - 10:13 AM
Post #5

New D.I.C Head
*

Joined: 18 May, 2009
Posts: 47


My Contributions
So for the particular task, you would recommend JavaScript instead of PHP?
User is offlineProfile CardPM
+Quote Post

Moonbat

RE: Header(Refresh...) Question

29 Jun, 2009 - 10:46 AM
Post #6

D.I.C Regular
Group Icon

Joined: 30 Jun, 2008
Posts: 423



Thanked: 24 times
Dream Kudos: 600
My Contributions
QUOTE(DecafJava @ 29 Jun, 2009 - 10:13 AM) *

So for the particular task, you would recommend JavaScript instead of PHP?

For something that's constantly changing, like a countdown, you have to use JavaScript. PHP won't work for a countdown display because whatever code was supposed to execute has already been executed on the server.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 01:38AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month