Google

Countdown timer before displaying download link or hyperlink using javascript

Google

Countdown timer before displaying download link or hyperlink using javascript

You may also like...

4 Responses

  1. Akshay says:

    Broo I Need your help how to use this code in post i added this code directly in post but it wont work then i added it with some html plugin then it works but when i change +url+ to my url it wont work again please help me i need your help

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    • admin says:

      Hello Akshay,

      What is the error you are seeing? Please change the URL variable to lowercase url as shown below and then provide your own hyperlink.

      //URL Details
      url='http://mistonline.in';
      
      VN:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
  2. Ashwani Garg says:

    hi,Thanks for this nice tutorials.
    I want to use “Countdown timer before displaying download link or hyperlink using javascript”, in my website.But it is not generating any link, it just outputs “time”element ,but not data element..I have not changed anything from your code.Please reply soon.
    Thanks.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    • admin says:

      Please check the demo webpage. Try using the below code. This should work.

      <script>var minutes =0;
      var seconds=40;
      url='http://mistonline.in';
      link_name='Mistonline.in Website'
      var timer=setInterval(function(){myCounter()},1000);
      function myCounter()
      {
      
      if(minutes > 59 || minutes < 0)
      {
      document.getElementById("time").innerHTML="<font color='red'>Please check the minutes variable, Set it in between 0 to 59</font>";
      }else
      {
           seconds--;
           if(seconds==0)
              {
                minutes=minutes-1;
                seconds=60;
              }
           document.getElementById("time").innerHTML=minutes +" Minutes "+seconds+" Seconds";
               if(minutes==-1)
                   {
                     clearTimeout(timer);
                     document.getElementById("time").innerHTML="Your Download Link Has Been Generated";
      			   document.getElementById("data").innerHTML="<a target='_blank' href='"+url+"'>"+link_name+"</a>";
       }            }
      }
      </script>
      <center><h2><div id="data">Please wait for the link to be generated.<p></div><div id="time"></div>
      
      VN:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)

Leave a Reply

Your email address will not be published. Required fields are marked *