每颗珍珠原本都是一粒沙子,但并不是每一粒沙子都能成为一颗珍珠。想要卓尔不群,就要有鹤立鸡群的资本。忍受不了打击和挫折,承受不住忽视和平淡,就很难达到辉煌。年轻人要想让自己得到重用,取得成功,就必须把自己从一粒沙子变成一颗价值连城的珍珠。
javascript判断文件是否存在
1. 客户端
<script language="javascript">
function FileExist()
{
var sfso=new ActiveXObject("Scripting.FileSystemObject");
var fPath="[The path of the file]";
if(sfso.FileExists(fPath))
{
alert("Exist");
}
else
{
alert("Doesn't exist");
}
}
</script>
2. 服务器端
<script language="javascript">
function FileExist()
{
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET",FileURL,false);
xmlhttp.send();
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200) alert("Exist");
else if(xmlhttp.status==404) alert("Doesn't exist");
else alert("Don't know");
}
}
</script>
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
以上就是javascript判断文件是否存在实例代码。考研历程,苦,此生拥有过,足!更多关于javascript判断文件是否存在实例代码请关注haodaima.com其它相关文章!