Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width" />
  <title>typeEffct</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body onload="typeEffect();">
  <span id="typeArea"></span>
  <script src="script.js"></script>
</body>
</html>
 
body
{
background-color: black;
font-family: "Courier New";
color: #00ff00;
}
 
var textSpan = document.getElementById("typeArea");
var letterPrint = 0;
function effectOne()
{
 textSpan.innerHTML = "H";
}
function effectTwo()
{
 textSpan.innerHTML = "He";
}
function effectThree()
{
 textSpan.innerHTML = "Hel";
}
function effectFour()
{
 textSpan.innerHTML = "Hell";
}
function effectFive()
{
 textSpan.innerHTML = "Hello";
}
/*
I tried to use
setInterval("playEffect()","1000");
but it doesn't work.
function playEffect()
{
 if (letterPrint == 0)
 {
  textSpan.innerHTML = "H";
  var letterPrint = 1;
 }
 else if (letterPrint == 1)
 {
  textSpan.innerHTML = "He";
  var letterPrint = 2;
 }
 else if (letterPrint == 2)
 {
  textSpan.innerHTML = "Hel";
  var letterPrint = 3;
 }
 else if (letterPrint == 3)
 {
  textSpan.innerHTML = "Hell";
  var letterPrint = 4;
 }
 else if (letterPrint == 4)
 {
  textSpan.innerHTML = "Hello";
  var letterPrint = 5;
 }
 else
 { 
  textSpan.innerHTML = "Hello";
 }
}*/
function typeEffect()
{
 setTimeout("effectOne()","1000");
 setTimeout("effectTwo()","1000");
 setTimeout("effectThree()","1000");
 setTimeout("effectFour()","1000");
 setTimeout("effectFive()","1000");
}
 
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers