Begini caranya
var downloadButton = document.getElementById("download");
var counter = 10; //Countdown dalam bentuk Seconds
var newElement = document.createElement("p");
newElement.innerHTML = "You can download the file in 10 seconds."; //Kata-katanya
var id;
downloadButton.parentNode.replaceChild(newElement, downloadButton);
id = setInterval(function() {
counter--;
if(counter < 0) {
newElement.parentNode.replaceChild(downloadButton, newElement);
clearInterval(id);
} else {
newElement.innerHTML = "You can download the file in " + counter.toString() + " seconds.";
}
}, 1000);
<a href="downloadFile.zip" id="download">Download the file...</a>
Ini untuk penerapan pada HTML.
Yang membuat website bertemakan Download-Mendownload bisa dipakai Button ini. Bisa juga digunakan di Safelink
Thursday, August 3, 2017
script
0 Response to Membuat Button dengan Waktu Mundur
Post a Comment