日期:2014-05-19 浏览次数:20696 次
<script type="text/javascript"> function checkPic() { alert("1111"); var picPath = document.getElementById("picPath").value; alert("picPath is " + picPath); var type = picPath.substring(picPath.lastIndexOf(".") + 1, picPath.length).toLowerCase(); if (type != "jpg" && type != "bmp" && type != "gif" && type != "png") { alert("error1"); return false; } return true; } function PreviewImage(divImage, upload, width, height) { try { var imgPath; var Browser_Agent = navigator.userAgent; if (Browser_Agent.indexOf("Firefox") != -1) { imgPath = upload.file[0].getAsDataURL(); document.getElementById(divImage).innerHTML = "__tag_48$49_" } else { var Preview = document.getElementById(divImage); alert(Preview); Preview.filters .item("DXImageTransform.Microsoft.AlphaImageLoader").src = upload.value; Preview.style.width = width; Preview.style.height = height; } } catch (e) { alert(e); } } </script>
<input type="file" id="picPath" name="doc" onchange="PreviewImage('Preview',this,120,120)"> <div id="Preview" style="filter: progid :DXImageTransform.Microsoft.AlphaImageLoader (sizingMethod = scale ;"></div>