Joe, at the risk of sounding patronizing, JavaScript cannot read or write information to or from files (on the server OR on a client’s computer.) You’ll need server side scripting for that: PHP, ASP.NET, Classic ASP and many others. I can give you code for PHP, but I do not know any other server languages.
PHP Code:
<?php
$filename = "tmp.txt";
//reading from file
$fp = fopen($filename, "r") or die("Couldn't open $filename Ln 5.");
while(!feof($fp)) {
$line = fgets($fp, 1024);
echo $line;
}
fclose($fp);
//writing to file
$fp = fopen($filename, "w") or die("Couldn't open $filename Ln 13.");
fwrite($fp, "Hello World");
fclose($fp);
?>
Bookmarks