#preview{width:300px;height:300px;border:1px solid #000;overflow:hidden;} #imghead {filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);} #preview_size_fake{ /* 该对象只用来在IE下获得图片的原始尺寸,无其它用途 */ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image); width:300px; visibility:hidden; overflow: hidden; } function previewImage(file) { var MAXWIDTH = 300; var MAXHEIGHT = 300; var div = document.getElementById(‘preview’); if (file.files && file.files[0]) { div.innerHTML = ”; var img = document.getElementById(‘imghead’); img.onload = function(){ var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight); img.width . . . → Read More: js图片上传本地预览兼容(IE7-8-9\firefox\chrome)
最新评论