Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.62 KB | None | 0 0
  1. <head>
  2.  
  3. <script type="text/javascript">
  4. function readTextFile(filePath)
  5. {
  6.     var rawFile = new XMLHttpRequest();
  7.     rawFile.open("GET", filePath, false);
  8.     rawFile.onreadystatechange = function ()
  9.     {
  10.         if(rawFile.readyState === 4)
  11.         {
  12.             if(rawFile.status === 200 || rawFile.status == 0)
  13.             {
  14.                 var allText = rawFile.responseText;
  15.                 document.write(allText);
  16.             }
  17.         }
  18.     }
  19.     rawFile.send(null);
  20. }
  21. </script>
  22.  
  23. </head>
  24. <body>
  25.  
  26. <script type="text/javascript">
  27.     readTextFile("file:///D:/Web/dane.txt");
  28. </script>
  29.  
  30.    
  31. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement