JavaScript 图片上传预览效果(11)

时间:2025-03-09

该文档说了怎么在页面做图片预览, 一步一步的

onErr: function(){},//预览错误时执行

以下在remote模式时有效

action: undefined,//设置action

timeout: 0//设置超时(0为不设置)

如果要使用remote模式必须设置一个action。

还提供了以下方法:

preview:执行预览操作;

dispose:销毁程序。

程序源码

Code highlighting produced by Actipro CodeHighlighter (freeware)

/

-->var ImagePreview = function(file, img, options) {

this.file = $$(file);//文件对象

this.img = $$(img);//预览图片对象

this._preload = null;//预载图片对象

this._data = "";//图像数据

this._upload = null;//remote模式使用的上传文件对象

var opt = this._setOptions(options);

this.action = opt.action;

this.timeout = opt.timeout;

this.ratio = opt.ratio;

this.maxWidth = opt.maxWidth;

this.maxHeight = opt.maxHeight;

this.onCheck = opt.onCheck;

this.onShow = opt.onShow;

this.onErr = opt.onErr;

//设置数据获取程序

this._getData = this._getDataFun(opt.mode);

//设置预览显示程序

this._show = opt.mode !== "filter" ? this._simpleShow : this._filterShow;

};

//根据浏览器获取模式

ImagePreview.MODE = $$B.ie7 || $$B.ie8 ? "filter" :

JavaScript 图片上传预览效果(11).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219