Files

G

Giacomin Alan

I have to do an exercise for school where in a HTML file I have to
read and write some words from a txt file. the two files are in
network, not in local. can someone help me? thanks a lot.

**Alan**
 
M

McKirahan

Giacomin Alan said:
I have to do an exercise for school where in a HTML file I have to
read and write some words from a txt file. the two files are in
network, not in local. can someone help me? thanks a lot.

**Alan**

Will this do?

<html>
<head>
<title>readwrit.htm</title>
<script type="text/javascript">
function readwrit(parm) {
var sFIL = "C:\\Temp\\readwrit.txt";
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oOTF;
if (parm == 1) {
oOTF = oFSO.OpenTextFile(sFIL,1);
document.form1.data.value = oOTF.ReadAll();
} else if (parm == 2) {
// "Permission denied" error on secord try!
oOTF = oFSO.OpenTextFile(sFIL,2,true);
oOTF.Write(document.form1.data.value)
}
}
</script>
</head>
<body>
<form name="form1">
<textarea name="data" cols="60" rows="10"></textarea>
<br>
<input type="button" value="Read" onclick="readwrit(1)">
&nbsp;
<input type="button" value="Write" onclick="readwrit(2)">
&nbsp;
<input type="reset" value="Clear">
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top