Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Reading text files with javascript

Reply
Thread Tools

Reading text files with javascript

 
 
paulnightingale
Guest
Posts: n/a
 
      04-03-2006
Hi
I've got a ticker tape that is written in Java Script 1.2 which
displays text that has to be currently changed in the program code.
What I want to do is to find the bit of javascript to get the program
to read a text file so that the text file can be used to update the
contents of the ticker tape. Preferably I will produce a bit of code
that produces a window in which you type the text you want to display
and then this gets saved as a text file, but firstly I need to get my
ticker tape program to read a text file for the content of the ticker
tape. If you have any suggestions on how to do this they would be much
appreciated.

Cheers

Paul

 
Reply With Quote
 
 
 
 
Julian Turner
Guest
Posts: n/a
 
      04-03-2006

paulnightingale wrote:

> Hi
> I've got a ticker tape that is written in Java Script 1.2 which
> displays text that has to be currently changed in the program code.
> What I want to do is to find the bit of javascript to get the program
> to read a text file so that the text file can be used to update the
> contents of the ticker tape. Preferably I will produce a bit of code
> that produces a window in which you type the text you want to display
> and then this gets saved as a text file, but firstly I need to get my
> ticker tape program to read a text file for the content of the ticker
> tape. If you have any suggestions on how to do this they would be much
> appreciated.
>
> Cheers
>
> Paul


Hi

This question has probably been answered a few times on this and other
news groups, so it is worth doing some searching on this news group or
<URL:http://www.webdeveloper.com/forum/forumdisplay.php?s=&daysprune=30&forumid=3>.

>From my amateur knowledge, reading a text file may be achived through

the following (depending on security settings):-

1. XMLHttpRequest object

If you set the URL to a local file name, you can access the contents
through the "responseText" property.

This is probably the most cross-browser method.

2. Active X - "Scripting.FileSystemObject"

This is an ActiveX object provided by Microsoft. It is only available
for browsers which support ActiveX, and have the
"Scripting.FileSystemObject" object installed on the client.

As far as I am aware you should find that "Scripting.FileSystemObject"
is commonly already installed on Windows clients.

Example:-

var FSO = new ActiveXObject("Scripting.FileSystemObject");
var nForReading=1;
var oFileObj = FSO.OpenTextFile(sFileName,nForReading, false);
var sFileContents=oFileObj.ReadAll();
oFileObj.Close();

3. XPCOM - Firefox Only

Firefox has XPCOM components. See an example for reading a file at the
bottom of the following page:-

<URL:http://www.captain.at/programming/xul/>

Regards

Julian Turner

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading files inside zip files from Javascript Narendra Sisodiya Javascript 7 12-08-2009 02:15 AM
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
how i can extract text from the PDF files,power point files,Ms word files? crazyprakash Java 4 10-30-2005 10:17 AM
Text files read multiple files into single file, and then recreate the multiple files googlinggoogler@hotmail.com Python 4 02-13-2005 05:44 PM
reading the DB vs. reading a text file...performance preference? Darrel ASP .Net 3 11-11-2004 02:27 PM



Advertisments