473,396 Members | 1,968 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.

read and write a file using javascript

How can we read or write a file(e.g. xxx.txt) using javascript?
May 16 '07 #1
2 15009
acoder
16,027 Expert Mod 8TB
Welcome to TSDN.

See this link. Note that ActiveX only works with IE.
May 16 '07 #2
u can read a word/txt File using this code..i hv copied my code here..check it out..
<html>

<head><title>snook.ca load document</title>

<script language="JavaScript">

<!--//

function loadworddoc(){

var doc = new ActiveXObject("Word.Application"); // creates the word object

doc.Visible=false; // doesn't display Word window

doc.Documents.Open("C:\\Documents and Settings\\trainer\\Desktop\\Samjad.doc"); // specify path to

document


//copy the content from my word document and throw it into my variable

var txt;

txt = doc.Documents("C:\\Documents and Settings\\trainer\\Desktop\\Samjad.doc").Content;

document.all.myarea.value = txt;

doc.quit(0); // quit word (very important or you'll quickly chew up memory!)

}

//-->

</script>

</head>

<body>

<p><input type=button onClick="loadworddoc();" value="Load">

<p><textarea name=myarea cols=100 rows=25>nothing here yet</textarea>

</body>

</html>

hope this may help u..
neha
May 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Christian Schmitt | last post by:
Hi, I want to write a script that (run from a file on the local HD) reads another local html-file into a variable, then make some changes to it, and then output the result in a way that makes it...
14
by: Randell D. | last post by:
Folks, Here's my problem: I am createing an array in a file using the reslut of some PHP and MySQL processing. An example of my array would be examlpe="example one"; examlpe="example...
5
by: floods | last post by:
I use Microsoft.XMLDOM load() method to load an XML file into memory and display some elements in the browser. However it apparently locks the file, since I get this error message whenever a...
17
by: chris.schwalm | last post by:
I would like to first state that I have searched through the archives and found a lot of related material, but am still new enough to javascript that I can't fit all the pieces together yet. So...
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
2
by: Alex | last post by:
Yes you can: <html><head><script language="javascript"> SaveToFile('This is a text to save in a file', 'C:\\temp\\test.txt'); alert(read('C:\\temp\\test.txt')); function SaveToFile (text,...
2
by: catronro | last post by:
I want to read an xml file and build a string based on that file. But when i try to implement it i get an Object Required error. Any help would be greatly appreciated. try { var xmlDoc = new...
10
dreamfalcon
by: dreamfalcon | last post by:
Hi! I need to read and write the content of a text file given by the users. The idea is to have two options. Read: -the user selects a file with a <input type="file"> -using javascript, read...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.