title: Javascript examples found on severial sites regarding fopen is not working for me
body: <p>I am trying to read a text file that is in the same directory as my html file using javascript so that I might include the contents of the text file in my html file.</p>
  <p>Here is the code I have to test the fopen and fread functions</p>
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;script&gt;
     fh = fopen('my.txt', 0); // Open the file for reading.
     if(fh!=-1) // Check if the file has been successfully opened.
     {
     length = flength(fh); // Get the length of the file.
     str = fread(fh, length); // Read in the entire file.
     fclose(fh); // Close the file.
     
     // Display the contents of the file.
     write(str);
     } 
  &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p>I've tried replacing the 'write' with document.write and still nothing.</p>
  <p>Here are some websites that had this code as an example:</p>
  <p><a href="http://answers.yahoo.com/question/index?qid=20130519190823AA2lQ1W" rel="nofollow noreferrer">http://answers.yahoo.com/question/index?qid=20130519190823AA2lQ1W</a></p>
  <p><a href="http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm" rel="nofollow noreferrer">http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm</a></p>
  <p>Any help at all would be much appreciated.</p>
  <p>Thank you!</p>