Time घटाव कोड

Ravindra Kumar
2 minute read
0

 



  <center>


<button type="button" onclick="myFunction()" id="countdown" style="background-color: DodgerBlue; font-family: verdana; font-size: 20px; color: white; padding: 12px 30px; ">Go To Download</button></center>


<div style="text-align: center;">


<a href="###" id="download_link" style="display: none;"><button style="background-color: DodgerBlue; border: none; color: white; padding: 12px 30px; cursor: pointer; font-size: 20px;" >Downlaod Link</button></a>


<noscript>JavaScript needs to be enabled in order to be able to download.</noscript>


<script type="application/javascript">


function myFunction(){


   var message = "%d seconds before download link appears";


   // seconds before download link becomes visible


   var count = 15;


   var countdown_element = document.getElementById("countdown");


   var download_link = document.getElementById("download_link");


   var timer = setInterval(function(){


      // if countdown equals 0, the next condition will evaluate to false and the else-construct will be executed


      if (count) {


          // display text


          countdown_element.innerHTML = "You have to wait %d seconds.".replace("%d", count);


          // decrease counter


          count--;


      } else {


          // stop timer


          clearInterval(timer);


          // hide countdown


          countdown_element.style.display = "none";


          // show download link


          download_link.style.display = "";


      }


   }, 1000);


}


</script>


Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Nosso site usa cookies para melhorar sua experiência. Verifique agora
Accept !