Hướng dẫn tạo hộp download có thời gian đếm ngược
Button download chuyển link ư, bình thường quá. Hãy sử dụng hộp download có thời gian đếm ngược này, nó vừa làm blog của bạn trở nên chuyên nghiệp hơn, vừa giữ chân người dùng lâu hơn. Cách thực hiện Bước 1: chèn đoạn js này trước thẻ đóng body <script type='text/javascript'> //<![CDATA[ function generate(){var e,n=document.getElementById("downloadx"),t=document.getElementById("btnx"),a=document.getElementById("downloadx").href,l=30,d=document.createElement("span");n.parentNode.replaceChild(d,n),e=setInterval(function(){--l<0?(d.parentNode.replaceChild(n,d),clearInterval(e),window.location.replace(a),n.style.display="inline"):(d.innerHTML="<p style='font-family:Google Sans, sans-serif'>Vui lòng chờ "+l.toString()+" seconds...</p>",t.style.display="none")},1e3)} //]]> </script> Bạn để ý đoạn l=30 có nghĩa là 30s, bạn chỉnh sửa lại số giây tùy ý. Bước 2: chèn
Comments
Post a Comment