实现代码如下:

function ReportFileStatus(filespec)
{
var fso, s = filespec;
fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.FileExists(filespec))
s += " exists.";
else
s += " doesn't exist.";
return(s);
}

采用客户端的 FileSystemObject 对象
例:
实现代码如下:

function check()
{
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
if( fso.FileExists("c:\\testfile.txt"))
{
alert("Exists!");
}
else
{
alert("not Exists!");
}
} 

以上就是【JavaScript下利用fso判断文件是否存在的代码】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论