博客
关于我
原生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时间相减的问题
查看>>
mysql时间表示和计算
查看>>
MySQL是如何做容器测试的?
查看>>
mysql更改数据库表utf-8_修改mysql数据库为 utf-8
查看>>