本文共 1333 字,大约阅读时间需要 4 分钟。
var type=request.getResponseHeader("Content-Type");if(type.indexOf("xml")!==-1 && request.responseXML){ callback(request.responseXML); //Document对象响应}else if(type==="application/json"){ callback(JSON.parse(request.responseText)); //JSON响应}
window.οnlοad=function(){var a=document.getElementById("dd");a.addEventListener("change",function(){alert(this.files) //返回一个FileList },false)}
request.οnprοgress=function(e){ if(e.lengthCopmputable){ progress.innerHTML=Math.round(100*e.loaded/e.total)+"%完毕!"; }}