将网站文件复制到Javscript中的本地计算机中 [英] Copy web site file into local machine in javscript

查看:81
本文介绍了将网站文件复制到Javscript中的本地计算机中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有下面写的代码.
它只能将网站文件复制到本地计算机上,当我将其与网络计算机一起使用时可以正常工作,但是如果我将其与网站一起使用,则无法正常工作.
我想将网站文件复制到本地计算机中,文件扩展名为.csv.

以下是我的代码:

Hi,

I have code which is written below.
Its working just copying website file to local machine, it works fine when I use it with a network computer, but if I us it with website it does not work.
I would like to copy website files into my local machine, the file extension is .csv.

Below is my code:

<html>
    <BODY >
    <script language="JScript">
    function copy()
    {
var ss;
var name = '\\\\131.0.0.202\\ks\\myfile\\ab.csv';
//var name = 'https://www.mnps.in/ab.csv';
var fl = new ActiveXObject("Scripting.FileSystemObject");
fileobj=fl.GetFile(name);
ss=fl.CopyFile(fileobj,"c:\\ab1.csv");
window.close();
}
    </script>
    Copying data from network and paste it into local.
    <form name="myForm" >
    <INPUT type="Button" value="Copy File" onload="copy();">
    </form>
    </BODY>
    </html>


我在两个不同的文件中使用相同的代码.首先是HTML,第二是HTML application(.hta),两者的工作原理相同,但是当我在线使用它时,它们根本无法工作.

给定的IP地址是我的本地计算机.

该代码在Internet Explorer中有效,但在Google Chrome和Firefox中不起作用.

请帮帮我.

预先感谢.


I am using the same code with two different files. First as HTML and 2nd as HTML application(.hta) both work the same, but when I use it online it does not work at all.

Given IP address is my local network machine.

This code is working in Internet Explorer, but not in Google Chrome and Firefox.

Please help me for that.

Thanks in advance.

推荐答案

http://msdn.microsoft.com/zh-cn/library/aa711216(v = vs.71).aspx

如果您使用Path属性(App.Path),ChDrive和ChDir语句或CurDir函数,请注意它们可能返回通用命名约定(UNC)路径(即,以\\ Server \ Share开头的路径). ..)而不是驱动器路径(例如e:\ Folder),具体取决于您如何运行程序或项目.

路径不应是类似于"https://www.mnps.in/ab.csv"的网址.
http://msdn.microsoft.com/en-us/library/aa711216(v=vs.71).aspx

If you use the Path property (App.Path), the ChDrive and ChDir statements, or the CurDir function, be aware that they may return a Universal Naming Convention (UNC) path (that is, one beginning with \\Server\Share...) rather than a drive path (such as e:\Folder), depending on how you run your program or project.

The Path should not be a url like ''https://www.mnps.in/ab.csv''.


这篇关于将网站文件复制到Javscript中的本地计算机中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆