Home >Web Front-end >JS Tutorial >js implementation code for displaying local images under ie8.0 img.src_image effects

js implementation code for displaying local images under ie8.0 img.src_image effects

WBOY
WBOYOriginal
2016-05-16 17:55:261209browse

ie8.0 displays local images img.src


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> function PreviewImage(imgFile) { var filextension=imgFile.value.substring(imgFile.value.lastIndexOf("."),imgFile.value.length); filextension=filextension.toLowerCase(); if ((filextension!='.jpg')&&(filextension!='.gif')&&(filextension!='.jpeg')&&(filextension!='.png')&&(filextension!='.bmp')) { alert("对不起,系统仅支持标准格式的照片,请您调整格式后重新上传,谢谢 !"); imgFile.focus(); } else { var path; if(document.all)//IE { imgFile.select(); path = document.selection.createRange().text; document.getElementById("imgPreview").innerHTML=""; document.getElementById("imgPreview").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果 } else//FF { path = imgFile.files[0].getAsDataURL(); document.getElementById("imgPreview").innerHTML = "<img id='img1' style="max-width:90%" height='100px' src='"+path+"'/ alt="js implementation code for displaying local images under ie8.0 img.src_image effects" >"; //document.getElementById("img1").src = path; } } } </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn