JavaScript writes a mock reading of a novel program

Source: Internet
Author: User
Tags ming

  This article mainly introduces the use of JavaScript to write a simulated reading of the novel program, the need for friends can refer to the following

  Code as follows: <html>  <meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>  <head>  <title></title>  <script type=" Text/javascript " >  function Reader (content, CID, Stopid, Continueid) {  this.conload = document.getElementById (CID);  THIS.STOPBTN = document.getElementById (stopid);  this.continuebtn = document.getElementById (ContinueID);  This.content = content;  This.index = 0;  var t = this;  This.stopBtn.onclick = (  function () {  return function () {  t.stopreader (t); }; }) (t);  This.continueBtn.onclick = (  function () {& nbsp return function () {  t.continuereader (t); }; }) (t); }  = Reader.prototype {  R:function () {  var t = this;  t.toid = setinterval (function () {  if (t.content[t.index)) {  T.con load.innerhtml + t.content[t.index]; }  t.index++;  if (T.content.length = = T.index) {  clearinterval (t.toid);  t.conload.innerhtml = "To Be Continued" "; } },"; }, : Function (t) {  T.flag = true;  clearinterval (t.toid); },  continuereader:function (t) {  if ( T.flag)   T.startreader ();  T.flag = false; } };  var content = "Mongolian Prince Monk Green Qin 慓 Shong Fierce, he led the army has always been known as Northen, Baqi, Greens He is beginning, not to mention those temporary recruitment of practice Yong. But this is the mob in his eyes, these years in the south of the fruitful, finally attack the Jiangning, won the battle against Taiping. "+ " On the contrary, his Mongolian cavalry in the rivalry with the Nien often defeated the war, by contrast, the former prestige has plummeted. This generation of heroes of the descendants of the former brothers and the Xiang Army nest a belly unknown anger. "+ " Xiang Army into the Jiangning, Rob Wealth, massacre arson, and release the young king, the opposition to slander Blasphemies four, South, Monk Green Qin heard very proud, hurriedly sent Fu Ming to inspect the town, to Jiangning field understanding. But Zeng a scare a bribe conquered Rich Ming Ah, jiangning general back to Monk Green Qin made a false report. Execution after the; //page load completes.   window.onload = function () {  new Reader (content, "content", "Btnstop", "Btncontinue"). Startreader ();  };  </script>  <body>  <div id= ' content ' ></div>  <div id= ' operate ' ><input type= ' button ' id= ' btnstop ' value= ' Stop '/><input type= ' button 'Id= ' btncontinue ' value= ' Continue '/></div>  </body>    </html> 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.