JavaScript 图片上传预览效果(13)
时间:2025-03-09
时间:2025-03-09
该文档说了怎么在页面做图片预览, 一步一步的
default :
return this._simpleData;
}
},
//滤镜数据获取程序
_filterData: function() {
this.file.select();
try{
return document.selection.createRange().text;
} finally { document.selection.empty(); }
},
//domfile数据获取程序
_domfileData: function() {
return this.file.files[0].getAsDataURL();
},
//远程数据获取程序
_remoteData: function() {
this._setUpload();
this._upload && this._upload.upload();
},
//一般数据获取程序
_simpleData: function() {
return this.file.value;
},
//设置remote模式的上传文件对象
_setUpload: function() {
if ( !this._upload && this.action !== undefined && typeof QuickUpload === "function" ) { var oThis = this;
this._upload = new QuickUpload(this.file, {
onReady: function(){
this.action = oThis.action; this.timeout = oThis.timeout;
var parameter = this.parameter;
parameter.ratio = oThis.ratio;
parameter.width = oThis.maxWidth;
parameter.height = oThis.maxHeight;
},
onFinish: function(iframe){
try{
oThis._preview( iframe.contentWindow.document.body.innerHTML ); }catch(e){ oThis._error("remote error"); }
},
onTimeout: function(){ oThis._error("timeout error"); }
});
下一篇:花岗岩与大理石石材的清洗与除锈