CoderZone.org

Category: >> JavaScript >> Countdown to Enable a Download Link Bookmark and Share

<< lastnext >>

Snippet Name: Countdown to Enable a Download Link

Description: How to enable a link after a set period of time (in this case, 30 seconds). After the countdown period is over the content in the "tmx" div is changed to contain the link.

Also see:
» INDEXES: ENABLE (function-based in...
» Timed link enabler

Comment: (none)

Author:
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: December 09th, 2010

<script type="text/Javascript">
xcounter=30;
function countdown(){
 
 if ((0 <= 100) || (0 > 0)) {
  xcounter--;
  if(xcounter== 0){
   document.getElementById("tmx").innerHTML = '<a href="http://www.somedomain.com/somepage.htm">Click to Download</a>';
  }
 
  if(xcounter> 0){
   document.getElementById("tmx").innerHTML = 'Please wait <b>'+xcounter+'</b> seconds...';
   setTimeout('countdown()',1000);
  }
 
 }
 
}
countdown();
</script>
 
<div id="tmx">&nbsp;</div>
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 10