Wednesday, December 23, 2009

What is the HTML coding to display something such as numbers counting down, by changing the actual page text?

Such as a forwarding page, telling you that you will be forwarded in 5, 4, 3, 2, 1, with the number changing in time on the page.What is the HTML coding to display something such as numbers counting down, by changing the actual page text?
You can do in Javascript.





Put this div anywhere you like and style it as necessary:





%26lt;div id=countdown%26gt;Forwarding in 5 seconds...%26lt;/div%26gt;





Then just put this javascript at the bottom of your web page.


Change redirect.html to be the page you are forwarding to..





%26lt;script language=Javascript%26gt;


var n = 5;


var i = setInterval('count()' , 1000);





function count() {


n--;


if(n) {


document.getElementById( 'countdown').innerHTML =


';Forwarding in '; + n + '; seconds...';;


}


else{


clearInterval(i);


location.href = ';redirect.html';;


}


}


%26lt;/script%26gt;What is the HTML coding to display something such as numbers counting down, by changing the actual page text?
This cannot be done in plain HTML. You would need to use JavaScript in order to accomplish this.





I searched for ';javascript countdown redirect'; and I got this:


http://javascript.internet.com/navigatio鈥?/a>





Don't forget to leave a link to the destination page so that people with JavaScript turned off can still use your page.

No comments:

Post a Comment