I am trying to make a simple script - writing something to a txt file when u press a button. I want to set it up on a localhost (full path - E:\xampp-portable\htdocs\test).
Currently stuck with this script:
<html>
<head>
<script language="javascript">
function Write()
{
var Scr = new ActiveXObject("Scripting.FileSystemObject");
var CTF = Scr.CreateTextFile("C:\\test.txt", true);
CTF.WriteLine('test');
CTF.Close();
}
</script>
</head>
<body onLoad="Write()">
</body>
</html>
It doesnt work tho. What path should i set here - var CTF = Scr.CreateTextFile("C:\\Gyan.txt", true);
? I think this is where i make my mistake. Also, are there any other simple ways to just write something to a already existing txt file with javascript?