本文介绍了解压缩文件时出现Javascript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function unzip(zipfile,extractpath){
var fso = new ActiveXObject('Scripting.FileSystemObject');
var oShell = new ActiveXObject('Shell.Application');
var dst,zip;
dst = shell.NameSpace(fso.getFolder(extractpath).Path);
zip = shell.NameSpace(fso.getFile(zipfile).Path);
for (var i=0; i<zip.Items().Count; i++) {
try {
if (fso.FileExists(zipfile)) {
WSH.Stdout.Write('Unzipping ' + zip.Items().Item(i) + '... ');
dst.CopyHere(zip.Items().Item(i), 4 + 16);
WSH.Echo('Done.');
}
}
catch(e) {
WSH.Echo('Failed: ' + e);
}
var zipfile = WSH.Arguments(0),
dest = zipfile.replace(/\.\w+$/, '\\');
unzip(zipfile, dest);
}
我的尝试:
此代码显示错误,因为ActiveXObject没有构造函数。
代码中缺少什么?
What I have tried:
This code is showing error as ActiveXObject doesnt have a constructor.
What is missing in the code?
推荐答案
我的尝试:
此代码显示错误,因为ActiveXObject没有构造函数。
代码中缺少什么?
What I have tried:
This code is showing error as ActiveXObject doesnt have a constructor.
What is missing in the code?
这篇关于解压缩文件时出现Javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!