网络编程
位置:首页>> 网络编程>> JavaScript>> JavaScript下利用fso判断文件是否存在的代码

JavaScript下利用fso判断文件是否存在的代码

  发布时间:2024-05-02 17:25:30 

标签:文件,是否存在

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!");
}
}
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com