Created
January 30, 2018 05:13
-
-
Save armaandh/c1815ba6231923aaab88b6abfef69bf1 to your computer and use it in GitHub Desktop.
my proj code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html><head> | |
| <style> | |
| #myDiv { | |
| max-width: 850px; | |
| margin: auto; | |
| } | |
| </style> | |
| <script> | |
| onload = function(){ | |
| var i = 0; | |
| var timer = setInterval(function(){ | |
| var req = new XMLHttpRequest(); | |
| req.open("GET", i+1+".txt", true); | |
| req.onreadystatechange = function() { | |
| if(req.readyState == 4){ | |
| if(req.status == 200) { | |
| if(i == 1) { | |
| var para = document.createElement("P"); | |
| para.id = "pTag"; | |
| var t = document.createTextNode(""); | |
| para.appendChild(t); | |
| para.innerText = req.responseText; | |
| document.getElementById("myDIV").appendChild(para); | |
| } else { | |
| document.getElementById("pTag").innerText += req.responseText; | |
| } | |
| } | |
| } | |
| } | |
| req.send(null); | |
| i++; | |
| if(i > 10) { | |
| clearInterval(timer); | |
| } | |
| }, 5000); | |
| } | |
| </script></head><body> | |
| <div id="myDIV"></div> | |
| </body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment