Posted in Javascript onAugust 05, 2010
<style type="text/css"> #newPreview { filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=images); } </style> <script type="text/javascript" language="javascript"> function PreviewImg(imgFile) { var newPreview = document.getElementById("newPreview"); newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value; newPreview.style.width = newPreview.offsetWidth /2; newPreview.style.height = newPreview.offsetHeight / 2; newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").sizingMethod = 'scale'; } </script>
请选择一个图片进行预览:
<input type="file" size="20" onchange="javascript:PreviewImg(this);" /> <div id="newPreview"></div>
FileUpload上传图片(图片不变形)
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@