<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> Typewriter Effects </title>
<body>
<div id= "Hotnews" >
</div>
<script type= "Text/javascript" >
var newstime=2000;
var texttime=50;
var newsi=0;
var txti=0;
var Txttimer;
var Newstimer;
var newstitle=new Array (); Weibo title
var newshref=new Array (); Weibo links
Newstitle[0]= "Health is the capital of the body";
newshref[0]= "#";
Newstitle[1]= "cares about the body, is concerned about oneself";
newshref[1]= "#";
newstitle[2]= "travel to Tibet";
newshref[2]= "#";
Newstitle[3]= "Heavy rain, very big ah";
newshref[3]= "#";
function Shownew () {
var endstr= "";
HWNEWSTR=NEWSTITLE[NEWSI];
NEWSLINK=NEWSHREF[NEWSI];
if (txti== (hwnewstr.length-1)) {
Endstr= "";
}
if (txti>=hwnewstr.length) {
Clearinterval (Txttimer);
Clearinterval (Newstimer);
newsi++;
if (newsi>=newstitle.length) {
newsi=0;
}
Newstimer=setinterval ("Shownew ()", newstime);
txti=0;
Return
}
Clearinterval (Txttimer);
document.getElementById ("Hotnews"). Href=newslink;
document.getElementById ("Hotnews"). Innerhtml=hwnewstr.substring (0,txti+1) +endstr;
txti++;
Txttimer=setinterval ("Shownew ()", texttime);
}
Shownew ();
</script>
</body>
JS Typewriter Effect Realization