Script question...


1

116

I have been attempting to create a timed script to display a particular way.
Trying to get the '10' to tic down. Any assist would be greatly appreciated.

<script type="text/JavaScript">
//Delay time...1000 = 1 sec
var seconds = 10
var pgname = "Terms & Conditions"
setTimeout("location.href = '../intranet/tnd.asp';",10000);
document.write("(This page will return to " + pgname + " in 10 seconds if
link is not clicked)");
</script>

Thanks
David
 
Ad

Advertisements

S

Stefan B Rusynko

See http://www.dynamicdrive.com/dynamicindex11/dhtmlprogress.htm for a timer bar

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


I have been attempting to create a timed script to display a particular way.
Trying to get the '10' to tic down. Any assist would be greatly appreciated.

<script type="text/JavaScript">
//Delay time...1000 = 1 sec
var seconds = 10
var pgname = "Terms & Conditions"
setTimeout("location.href = '../intranet/tnd.asp';",10000);
document.write("(This page will return to " + pgname + " in 10 seconds if
link is not clicked)");
</script>

Thanks
David
 
J

Jon Spivey

Hi,
I wouldnt use the dynamic drive script referenced above - it's somewhat
outdated now :) To get the countdown you just need something like this

<p>this page will return in <span id="timer">10</span> seconds</p>
<script type="text/javascript">
var x = 10;
window.onload = function(){window.setTimeout(tic, 1000);}
function tic() {
if (x == 0){location.href = 'terms.asp';}
else
{x--;document.getElementById('timer').innerHTML=x;window.setTimeout(tic,
1000);}}
</script>

Cheers,
Jon
http://MyMobileDeal.com
 
Ad

Advertisements

1

116

Thanks Jon.

Jon Spivey said:
Hi,
I wouldnt use the dynamic drive script referenced above - it's somewhat
outdated now :) To get the countdown you just need something like this

<p>this page will return in <span id="timer">10</span> seconds</p>
<script type="text/javascript">
var x = 10;
window.onload = function(){window.setTimeout(tic, 1000);}
function tic() {
if (x == 0){location.href = 'terms.asp';}
else
{x--;document.getElementById('timer').innerHTML=x;window.setTimeout(tic,
1000);}}
</script>

Cheers,
Jon
http://MyMobileDeal.com




.
 

Similar threads

D
2
Replies
26
Views
332
Spike
S
J
Replies
1
Views
233
Steve Easton
S
L
Replies
1
Views
103
MD Websunlimited
M
W
Replies
5
Views
186
Wayne-I-M
W
N
Replies
1
Views
175
David Bartosik [MSFT MVP]
D
M
Replies
1
Views
160
clintonG
C
R
Replies
5
Views
183
realtyonegroup
R
S
Replies
4
Views
171
Sam Bryan
S
Top