473,563 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 20164

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.webdevelope r.com/forum/forumdisplay.ph p?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 "responseTe xt" property.

This is probably the most cross-browser method.

2. Active X - "Scripting.File SystemObject"

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

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

Example:-

var FSO = new ActiveXObject(" Scripting.FileS ystemObject");
var nForReading=1;
var oFileObj = FSO.OpenTextFil e(sFileName,nFo rReading, false);
var sFileContents=o FileObj.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
2790
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 will from time to time receive 4 - 5 PDF files into a directory; I want to be able to schedule a task which will pick up these 4 - 5 PDFs, read...
6
20492
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: text-decoration : underline overline; when reading element.currentStyle.textDecoration I only get "underline"!! What's worse is that...
2
3023
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 company internal use that will extract information from a drawing on the user's local workstation and then needs to convey that information to a web...
4
6911
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 file, use it to fill some variables on a webpage. And have that webpage save any changes. Is there a single command like the C fopen("filename",...
1
3110
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. However, every now and then certain ASCII characters, like the quote (") for example, gets read in and creates Javascript errors when the browser...
1
6742
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 listen up; Reports, the way I look at them, all present data downwards, in this way; TITLE data
50
4898
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 -- the character input is a different matter, at least if I want to remain within the bounds of the standard library.
29
2985
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 switch/case to take action based on that value in the cookie. I want to set the cookie manually, so I don't need setcookie(). I see that in PHP it...
10
3516
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 = fso.OpenTextFile( Server.MapPath("orbit.csv"), ForReading); return(f.ReadAll()); }
0
7885
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.