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
 
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
 
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




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top