復制代碼 代碼如下:
<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>