| | |
Really simple script request - Count from 6 - 0
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I have looked high and low for a very simple script that i can use to display on a page from 6 down to 1.
Basically it should start like this:
"this page will redirect in 6 seconds"
and end like this:
"this page will redirect in 0 seconds"
I know exactly the type of people on this forum and how clever you are so if you could please just help me out, I will be really really grateful.
Thanks
Basically it should start like this:
"this page will redirect in 6 seconds"
and end like this:
"this page will redirect in 0 seconds"
I know exactly the type of people on this forum and how clever you are so if you could please just help me out, I will be really really grateful.
Thanks
Normally such a thing is almost always done using a server side script (you know why), but since you have been nice in your conduct on Daniweb, I would try something out for you. 
How about something like:
Just let me know if it works for your cause. ;-)

How about something like:
javascript Syntax (Toggle Plain Text)
<!-- author: Sanjay aka ~s.o.s~ A simple redirection script which runs on the client side. --> <html> <head> <style> .myDiv { text-align: center; font: italic small-caps 900 14px arial } </style> <script> var count = 5; var timerHandle; var URL = "[URL]http://www.yahoo.com[/URL]"; var SITE_NAME = "Yahoo"; function startCountDown() { update(); timerHandle = setInterval("update()", 1000); } function update() { if(count <= 0) { clearInterval(timerHandle); document.getElementById('txt').innerHTML = 'Redirecting, please wait...'; window.location.assign(URL); /* You can also use the window.location.replace() function with the difference being you won't be able to hit the back button once the new page has been loaded. Use the function which suits your purpose */ } else { //you can also embed the entire message in a 'anchor' tag so that the user can decide not to //wait and click on the link to go to the site. document.getElementById('txt').innerHTML = 'You would be redirected to '+ SITE_NAME + ' in ' + count + ' seconds.'; --count; } } </script> </head> <body onload="javascript:startCountDown();"> <br /><br /><br /> <div class="myDiv" id="txt"></div> </body> </html>
Just let me know if it works for your cause. ;-)
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- simple script request [account balance calculation] (JavaScript / DHTML / AJAX)
- Simple script parser - how to ? (C++)
- [Need Help] shell scripting count data in files (Shell Scripting)
- Learning PHP but problem with script (PHP)
- A simple script to execute a command package (Shell Scripting)
- derive full name of user and grep search count (Shell Scripting)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Random text and images
- Next Thread: help on passing variable to a function?
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor date debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n






