Hi all, I know that this may not be the right section for scripts, but does anyone know where I could get this script? I just thought that some vendors around here may use this type of script. I am in the process of adding a discount page on my CB website, when a potential customer exits, it loads. But what I need now is, is a countdown timer that resets and starts again, if you know what I mean. Say it's a Thursday and the offer expires in 24 hours, but then I want it to reset on Friday and the 24 hour expiration date to start again and so forth. Thanks, Dim.
in head <script type="text/javascript"> window.onload = function() { /* set your parameters( number to countdown from, pause between counts in milliseconds, function to execute when finished ) */ startCountDown(1590, 1000, myFunction); } function startCountDown(i, p, f) { // store parameters var pause = p; var fn = f; // make reference to div var countDownObj = document.getElementById("countDown"); if (countDownObj == null) { // error alert("div not found, check your id"); // bail return; } countDownObj.count = function(i) { // write out count countDownObj.innerHTML = i; if (i == 0) { // execute function fn(); // stop return; } setTimeout(function() { // repeat countDownObj.count(i - 1); }, pause ); } // set it going countDownObj.count(i); } function myFunction() { alert("You Snooze You Lose"); } </script> Code (markup): in body <div id="countDown"></div> Code (markup): Cheers, Drew