yunmoxue 发表于 2013-2-7 16:59:04

FireFox3 IE8 图片预览

http://luolonghao.iteye.com/blog/1188020


$(document).ready(function(){$("#upload_img").change(function(e){if(this.files){var file = this.files;if(FileReader){var oFReader = new FileReader();oFReader.onload = function (oFREvent) {$("#img_review").attr("src",oFREvent.target.result);};oFReader.readAsDataURL(file);}else{$("#img_review").attr("src",file.getAsDataURL());}}else if(navigator.userAgent.indexOf("MSIE 6.0")>=1){$("#img_review").attr("src",this.value);}else if(navigator.userAgent.indexOf("MSIE 7.0")>=1 || navigator.userAgent.indexOf("MSIE 8.0")>=1){      var src = '';      this.select();      try {          src = document.selection.createRange().text;      } finally {          document.selection.empty();      }      src = src.replace(/[)'"%]/g, function(s){ return escape(escape(s)); });      img_review.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale',src=\"" + src + "\")";}$("#img_review").css("display","block");});});
页: [1]
查看完整版本: FireFox3 IE8 图片预览