<HTML><HEAD>
<TITLE>Create Text File</TITLE>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="">
function validate() {
	if(document.form.dir.value<=0) {document.write('Error!');return false;}
	else create();
}
function create() {
	var dir = document.form.dir.value;
	var nobj = new ActiveXObject("Scripting.FileSystemObject");
	var x = nobj.CreateTextFile(""+dir+"", true);
	x.WriteLine("Write in file!");
	x.Close();
	document.write('<B>'+document.form.dir.value+'</B> created!');
}
</SCRIPT>
</HEAD><BODY>
<FORM NAME="form" onSubmit="validate();return false">
<input type="text" name="dir" value="C:\New.txt">
<BUTTON TYPE="submit">Create File</BUTTON>
</FORM>
Published in: ActiveX
Download

Related snippets