在js中判断文件的存在   如果url不存在的话,就会‘死’掉   这个怎么解决,或者说怎么设置它的超时时间
      xmlhttp.setTimeouts(50000, 50000, 5000, 5000 );  这样根本就没作用   如果解决

解决方案 »

  1.   

    xmlhttp 这不就是用的异步方式吗?
     var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");//getXMLHTTPRequest();new ActiveXObject("MSXML2.ServerXMLHTTP")//
     //  xmlhttp.setTimeouts(50000, 50000, 5000, 5000 );
      xmlhttp.open("head",imgFile.value,true); 
      xmlhttp.send();
      xmlhttp.onreadystatechange=function(){ 
      if(xmlhttp.readyState==4) 
      {
          if(xmlhttp.status==200) 
        { 
         var newPreview = document.getElementById(prev);
         newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
         newPreview.style.width = "30px";
         newPreview.style.height = "25px";
       }
        else if(xmlhttp.status=="404"){ alert('图片路径不正确')  } 
      

  2.   

    我使用简单强大的asp.net ajax(你可以搜一下System.Web.Script.Services.ScriptService),对这种代码暂时不考虑。