Home >Web Front-end >JS Tutorial >IE8 local image upload preview sample code_javascript skills

IE8 local image upload preview sample code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:04:051048browse
Copy code The code is as follows:

imgpath= getRealPath(fileId);

document. getElementById("divSBTP").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src="" imgpath "")";//Use filter effects

function getRealPath(fileId){

var file_upl = document.getElementById(fileId);

file_upl.select();

return document.selection.createRange ().text;
}

Note: ie8 local image upload preview cannot directly use $("#img").attr("src",imapath) because of restrictions on browser access Local files, so filters and divs are used. If filters and img are used, a broken image mark will appear.
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