博客
关于我
原生js之图片预览的封装
阅读量:201 次
发布时间:2019-02-28

本文共 270 字,大约阅读时间需要 1 分钟。

图片预览

_this:input[file]对象

_thisNext:下一个要操作的dom对象
cb:回调函数

function changeImg(_this,_thisNext,cb){	var reader = new FileReader();    reader.readAsDataURL(_this.files[0]);	reader.onload = function(e){		_this.nextSibling.src = e.target.result;		if(cb){			cb(_thisNext);		}	}}

转载地址:http://lohi.baihongyu.com/

你可能感兴趣的文章
MYSQL之REPLACE INTO和INSERT … ON DUPLICATE KEY UPDATE用法
查看>>
MySQL之SQL语句优化步骤
查看>>
MYSQL之union和order by分析([Err] 1221 - Incorrect usage of UNION and ORDER BY)
查看>>
Mysql之主从复制
查看>>
MySQL之函数
查看>>