reading txt files

Is there a way I can read a txt file into javascript? What I'd be looking for is something like this:

a bunch of text is in this file
like maybe a story
or an article
or something like that

var textFile = new array();

function show_textFile(txtFile) {
//read the text in txtFile into the textFile array

for (a=0;a<{length of file};a++) {


  • I'm not sure if this is possible using JavaScript but if you find a way could you e-mail me at . You can use server-side languages to read and write to text files on the server such as ASP and JSP. Another option is to use cookies. For any help on these subjects, e-mail me at the address above.

  • That's too bad, I was afraid javascript wouldn't be able to do that. Thanks though, I'll be sure to send you anything if I do find it.

  • Mabey you can use an tag:

    line = new string()

    line = document.form1.textfile.value;

    I hope this works for you...



  • I realised that what I suggested will not work. I suggest you try using PHP if your provider supports this(most providers do so).

    Take a look at


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!