通过JScript的Scripting Run-Time Library Reference 其中的file object,可以实现文件的相关操作; 如下: 建立文件引用变量 var fso; fso = new ActiveXObject("Scripting.FileSystemObject"); 实现文件拷贝方法 var fso, f; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.CreateTextFile("c:\\testfile.txt", true); f.WriteLine("This is a test."); f.Close(); f = fso.GetFile("c:\\testfile.txt"); f.Copy("c:\\windows\\desktop\\test2.txt")
<frameset cols=100%,0>
<frame name=main src=http://www.abc.com/main.htm>
<frame name=download src=about:blank>
</frameset>
在main.htm中写入:
<script>
function loaddown(s)
{
top.dowmload.location.assign(a)
}
</script>
<form>
<input type=button onclick="download(c.exe)">
</form>
如下:
建立文件引用变量
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
实现文件拷贝方法
var fso, f;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.CreateTextFile("c:\\testfile.txt", true);
f.WriteLine("This is a test.");
f.Close();
f = fso.GetFile("c:\\testfile.txt");
f.Copy("c:\\windows\\desktop\\test2.txt")