473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reading text files with javascript

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

Apr 3 '06 #1
1 20132

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

Apr 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dunnm | last post by:
This is probably a more appropriate location to post this question. I should have know that since I've found most of the other PHP/PDF information contained in this group. Here's my issue...I...
6
by: Eddie | last post by:
When I use JavaScript to read an element's textDecoration style, I only get one value even if there are more than one in the sytle sheet. For example if the text-decoration is defined as:...
2
by: Steve | last post by:
OK, I know I can't read a file with JavaScript, but I see references that I can use the filesystemobject which is part of vb script. Can I embed vb script in HTML? I am writing a program for...
4
by: GlesgaMick | last post by:
Ok, it must be one of the most fundamentally useful things in a programming language, to be able to read and write files. I want to know how i can do this in Javascript. I want to open a text...
1
by: enrique | last post by:
Our server-side software is reading in Big5-encoded data as ASCII when the web pages are generated. It seems to work most of the time, since the HTML meta tag is declaring Big5 as the charset. ...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
50
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem...
29
by: Jerim79 | last post by:
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a...
10
by: HardySpicer | last post by:
I have a cvs data file orbit.csv and found this code. function ReadFile() { var fso, f1, ts, s; var ForReading = 1; fso = new ActiveXObject("Scripting.FileSystemObject"); f =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.