...

View Full Version : writing to a text file with javascript



glz
06-19-2007, 04:25 AM
Hello I'm having trouble writing to a text file with javascript, i've tried writing to a local text file on my own PC, and I've also tried writing to a local file on my own server, (which I have all permissions to do so...)

I'd really like to write to a file that resides on my own web server.
Here is my code:


<head>
<SCRIPT LANGUAGE="JavaScript">
function WriteToFile() {

set fso = CreateObject("Scripting.FileSystemObject");
set s = fso.CreateTextFile("C:\test.txt", True);
s.writeline("HI");
s.writeline("Bye");
s.writeline("-----------------------------");
s.Close();
}
</SCRIPT>
</head>
<body>
<form onSubmit="WriteToFile()">
<input type="submit" value="Run the WriteToFile Function!">
</form>
</body>


quite frankly it just doesn't work, you know what I want to do, I gave you my attempt, please help me do it

thank you

smalldog
06-19-2007, 05:03 AM
Why don't use rather some server side script language? Javascript is the client side script so don't try to perform some actions on the server side, ASP and PHP are the server side scripting languages and that's the right choice.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum