01 January 2019

TUTORIAL : Typewriter


Typewriter? Apa tu? Mesti korang tertanya-tanya kan? Contoh dia macam kat bawah ni

Typewriter


<button onclick="typeWriter()">Click me</button>
<p id="demo"></p>
<script style= "text/css">
var i = 0;
var txt = 'TEKS SINI';
var speed = 50;
function typeWriter() {
  if (i < txt.length) {
    document.getElementById("demo").innerHTML += txt.charAt(i);
    i++;
    setTimeout(typeWriter, speed);
  }
}
</script>

No comments:

Post a Comment