<!--
It is possible to do this using ActiveX embedded into your JavaScript
It works but it brings up a window asking if you want to run the script because it might be UNSAFE
-->
<html>
<head><Script language="JavaScript"><!--
function WriteToFile()
{ var filename = "data.txt";
var fso = new ActiveXObject("Scripting.FileSystemObject"
if (fso.FileExists(filename)) {
var a, ForAppending, file;
ForAppending = 8;
file = fspenTextFile(filename, ForAppending, false);
file.WriteLine("Hello Again"
} else {
var file = fso.CreateTextFile(filename, true);
file.WriteLine("HELLO"
}
file.Close();
}
//-------------------------------------------------------
function ReadFromFile() {
var fso, a, ForReading; ForReading = 1;
fso = new ActiveXObject("Scripting.FileSystemObject"
file = fspenTextFile(filename, ForReading, false);
var name = file.readline();
var password = file.readline();
file.Close();
}
//-------------------------------------------------------
-->
</Script>
<body>
<script>
WriteToFile();
</script>
</body>
</html>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.