如何判断服务端文件是否存在?在线等,马上给分 如果單單靠javascript要判斷可能有點麻煩大概思路:用一個窗口去load欲判斷文件,如果沒有發生error則存在,如果錯誤則不存在。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 xmlhttpxmlhttp.status == 404 //网页不存在 <script type="text/javascript">function CheckPage(url){ var h = new ActiveXObject("Microsoft.XMLHTTP"); h.open("HEAD",url,false); h.send(); return h.status==200;}if(CheckPage("http://www.heroworld.net/heroes3site/index.htm")) //测试的页面alert("存在");elsealert("不存在");</script>有人问过同样问题http://community.csdn.net/Expert/topic/3331/3331784.xml?temp=.4060175 C#写的ActiveX插件在ExtJS面板里闪动的问题。求解答啊... JS 与 RUNAT="Server" 的问题 html表单里输入指定类型的数据 用随机概率密度函数检索多维易变数据 Obj实例化不起作用 个人珍藏javascript菜单特效 请教:焦点图片轮换显示的速度如何设置 js if 时间验证判断 iframe问题 关于onLoad问题(急!) JS如何模拟VBS中的LenB、MidB、ChrB、AscB等字节函数 怎么知道用户当前操作是“刷新”
function CheckPage(url)
{
var h = new ActiveXObject("Microsoft.XMLHTTP");
h.open("HEAD",url,false);
h.send();
return h.status==200;
}
if(CheckPage("http://www.heroworld.net/heroes3site/index.htm")) //测试的页面
alert("存在");
else
alert("不存在");
</script>有人问过同样问题
http://community.csdn.net/Expert/topic/3331/3331784.xml?temp=.4060175