hi,
im using this code
to create a file on my Hard Drive by saving the page simply in Desktop and execute it by double clicking the pageCode:<script> function load() { var fso, f, r; var ForReading = 1, ForWriting = 2; var str='Scripting.FileSystemObject'; fso = new ActiveXObject(str); var file = 'c:/testfile.txt'; f = fso.OpenTextFile(file, ForWriting, true); var text ='Hello world!'; f.Write(text); f.Close(); alert('done'); } load(); </script>
this is a simple html page.
but i want to create this file on my localhost by putting this html file in my localhost and i want to execute this file like
but it does not create the file on localhost with this codeCode:http://localhost/dir/file.htm
and shows an error likeCode:<script> function load() { var fso, f, r; var ForReading = 1, ForWriting = 2; var str='Scripting.FileSystemObject'; fso = new ActiveXObject(str); var file = 'http://localhost/dir/testfile.txt'; f = fso.OpenTextFile(file, ForWriting, true); var text ='Hello world!'; f.Write(text); f.Close(); alert('done'); } load(); </script>
Code:bad file name or number




Reply With Quote