New to Javascript.
All I want to do is prompt a user for a source file name (which will include a drive letter) and copy that file to a destination (right now, default, hard-coded folder name). Any help?
Thanks!
****************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Form input</title>
<SCRIPT language = "JavaScript">
<!--
function Button1_OnClick(form) {
var fso, fl;
fname_str = form.fName.value;
if (fname_str.length < 1) {
alert("You didn't enter a file name");
return;
}
fso = new ActiveXObject("Scripting.FileSystemObject");
fileObj = fso.GetFile(fname_str);
fso.CopyFile(fileObj, "D:\\MicroSurvey\\WorkFiles\\"+fname_str, true);
return;
}
function fName_OnBlur(form) {
fname_str = form.fName.value;
if (fname_str.length < 1) {
alert("You didn't enter a file name");
return;
}
return;
}
//-->
</script>
</head>
<body bgcolor="#C0C0C0">
<h3>Button Test</h3>
<hr>
<br>
Enter the file name, including drive letter (e.g., H
and path<br>
For example, H:\username\foldername\projectname<br>
<br>
<hr>
<form name="ValidForm">
<p>
File Name To Be Copied:
<input type="text" size="25" name="fName" onBlur="fName_OnBlur(this.form)">
<br><br>
This file will be copied to <b>D:\MicroSurvey\WorkFiles</b>
<br><br>
<input type="button" name="Button1" value=" OK " onClick="Button1_OnClick(this.form)">
<hr>
<br><br>
<input type="button" value="Close this window" onClick="window.close()">
</p>
</form>
</body>
</html>
All I want to do is prompt a user for a source file name (which will include a drive letter) and copy that file to a destination (right now, default, hard-coded folder name). Any help?
Thanks!
****************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Form input</title>
<SCRIPT language = "JavaScript">
<!--
function Button1_OnClick(form) {
var fso, fl;
fname_str = form.fName.value;
if (fname_str.length < 1) {
alert("You didn't enter a file name");
return;
}
fso = new ActiveXObject("Scripting.FileSystemObject");
fileObj = fso.GetFile(fname_str);
fso.CopyFile(fileObj, "D:\\MicroSurvey\\WorkFiles\\"+fname_str, true);
return;
}
function fName_OnBlur(form) {
fname_str = form.fName.value;
if (fname_str.length < 1) {
alert("You didn't enter a file name");
return;
}
return;
}
//-->
</script>
</head>
<body bgcolor="#C0C0C0">
<h3>Button Test</h3>
<hr>
<br>
Enter the file name, including drive letter (e.g., H

For example, H:\username\foldername\projectname<br>
<br>
<hr>
<form name="ValidForm">
<p>
File Name To Be Copied:
<input type="text" size="25" name="fName" onBlur="fName_OnBlur(this.form)">
<br><br>
This file will be copied to <b>D:\MicroSurvey\WorkFiles</b>
<br><br>
<input type="button" name="Button1" value=" OK " onClick="Button1_OnClick(this.form)">
<hr>
<br><br>
<input type="button" value="Close this window" onClick="window.close()">
</p>
</form>
</body>
</html>
Comment