JavaScript下利用fso判断文件是否存在的代码
摘要:复制代码代码如下:functionReportFileStatus(filespec){varfso,s=filespec;fso=newA...
复制代码 代码如下:
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判断文件是否存在的代码】相关文章:
★ JavaScript中用toString()方法返回时间为字符串
★ 浅谈JavaScript中的Math.atan()方法的使用