js上传图片预览 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript" src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $(".file").change(function(){ var fileImg = $(".fileImg"); var explorer = navigator.userAgent; var imgSrc = $(this)[0].value; if (explorer.indexOf('MSIE') >= 0) { if (!/\.(jpg|jpeg|png|JPG|PNG|JPEG)$/.test(imgSrc)) { imgSrc = ""; fileImg.attr("src","/img/default.png"); return false; }else{ fileImg.attr("src",imgSrc); } }else{ if (!/\.(jpg|jpeg|png|JPG|PNG|JPEG)$/.test(imgSrc)) { imgSrc = ""; fileImg.attr("src","/img/default.png"); return false; }else{ var file = $(this)[0].files[0]; var url = URL.createObjectURL(file); fileImg.attr("src",url); } } }) }) </script> </head> <body> <form enctype="multipart/form-date" method="post"> <input type="file" class="file"> <input type="submit" class="sub"> </form> <img src="" class="fileImg"> </body> </html>
相关推荐
js上传图片预览图片.pdf
dom原理实现js上传图片预览dom原理实现js上传图片预览dom原理实现js上传图片预览dom原理实现js上传图片预览dom原理实现js上传图片预览dom原理实现js上传图片预览dom原理实现js上传图片预览dom原理实现js上传图片预览...
JS上传图片预览,支持IE,火狐,谷歌等浏览器
javascript 上传图片预览效果,兼容:ie6/7/8, firefox 3.5.5
JavaScript 上传图片预览效果.zip
Vs2010 + js,单独的写了AjaxUpload.js,上传图片预览并保存到/upload/temp,上传非jpg && jpeg格式图片的时候,请更改验证方式Upload.aspx.cs
JS+asp.net+图片上传+预览+支持多上传+上传前预览
原生 js 整合的一个图片上传预览控件,实现类似微信朋友圈选择删除图片的效果。不依赖任何其他js框架
js上传图片 图片预览 js上传图片 图片预览
js 图片上传 并预览图片
纯javascript实现上传图片前图片预览,判断图片大小,兼容ie-7到10 firefox chrome,非常不错,分享给大家。
实用JS,jQuery实现上传图片的预览功能,可以跟随鼠标移动
NULL 博文链接:https://sumlog.iteye.com/blog/557568
最近也经常遇到浏览器兼容的问题,昨天遇到上传图片预览问题,发现IE8和火狐不能显示,弄了很久,早上终于解决了很高兴。故跟大家分享下,我也多是网上找的,自己总结的一下,希望对大家有点帮助。 我们一般根据IE6...
一个小DEMO,直接复制到页面就可以使用,很方便,注释明确,拿来学习也很方便, 兼容ie[6-9]、火狐、Chrome17+、Opera11+、Maxthon3