複製代碼代碼如下:
<html>
<meta http-equiv =“ content-type” content =“ text /html; charset = utf-8” />
<頭>
<title> </title>
<腳本類型=“ text/javascript”>
函數讀取器(內容,CID,StopID,ConlineID){
this.conload = document.getElementById(cid);
this.stopbtn = document.getElementById(stopID);
this.continuebtn = document.getElementById(繼續);
this.content = content;
this.index = 0;
var t = this;
this.stopbtn.onclick =(
功能 () {
返回函數(){
T.StopReader(T);
};
})(t);
this.continuebtn.onclick =(
功能 () {
返回函數(){
t.continuereader(t);
};
})(t);
}
reader.protype = {
Startreader:function(){
var t = this;
t.toid = setInterval(function(){
if(t.content [t.index]){
t.conload.innerhtml += t.content [t.index];
}
t.index ++;
if(t.content.length == t.index){
clear Interval(t.toid);
t.conload.innerhtml +=“【未完待續】”;
}
},200);
},,
stopReader:function(t){
t.flag = true;
clear Interval(t.toid);
},,
continueReader:function(t){
如果(t.flag)
t.startreader();
t.flag = false;
}
};
var content =“蒙古親王僧格林沁悍勇猛,他率領的軍隊向來號稱能征慣戰,八旗兵、綠營他都看不上眼,更何況那些臨時招募的練勇。可偏偏就是這些他眼中的烏合之眾,這些年來在江南戰果累累,最終攻下了江寧,奪得了對太平軍作戰的全勝。” +
“相反地,他的蒙古鐵騎在與捻軍的角逐中常常打敗仗,相形之下,昔日的聲威銳減。這個一代天驕的後裔,對曾氏兄弟和湘軍窩著一肚皮無名怒火。” +
“湘軍進江寧後。誰料曾國荃一嚇一賄征服了富明阿,江寧將軍回去後向僧格林沁作了假匯報。”;
//頁面加載完成之後執行。
window.onload = function(){
新讀者(內容,“ content”,“ btnstop”,“ btncontinue”)。startreader();
};
</script>
<身體>
<div ID ='content'> </div>
<div id ='tarte'> <input type ='button'id ='btnstop'value ='stop'/stop'/> <input type type ='button'id ='btncontinue'value ='繼續
</body>
</html>