View Single Post
  #1 (permalink)  
Old October 13th, 2004, 04:07 AM
interrupt interrupt is offline
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default Permission Denied Error

Hi all,

This is my script, I have pointed out the error where my debugger kicks in:

<body>
<form name ="form1">
Customer Name:<br>
<input type ="text" name ="text1"><br>
Customer Surname:<br>
<input type ="text" name ="surname"><br>
Address:<br>
<Textarea name ="Address" rows =5 cols =10></textarea><br>
Telephone Number:<br>
<input type ="text" name ="telno"><br>
Delivery Number:<br>
<input type ="text" name = "delno">
<input type ="button" name ="button1" value ="Post" onclick = "postToFile()">
</form>

function postToFile(){
var filenameIs = "c:\\" + document.form1.delno.value + ".txt"
var TristateFalse = 0;
var ForWriting = 2;

myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
file = myActiveXObject.CreateTextFile(filenameIs);
file = myActiveXObject.GetFile(filenameIs2);
text = file.OpenAsTextStream(ForWriting, TristateFalse);//Permission Denied Here
text.Write(document.form1.text1.value + '\n' + document.form1.surname.value + '\n' + document.form1.Address.value + '\n' + document.form1.telno.value + '\n' + document.form1.delno.value);
text.Close()
}
</script>

What I'm trying to do is create a small text file of information, the filename is created from the variable called 'filenameIs' which gets its value from the field called 'delno'. Any idea why I get permission denied?

cheers
interrupt

__________________
\'sync\' &lt;cr&gt;
The name specified is not recognized as an internal or external command, operable program or batch file.