上传图像前的图像预览jquery

上传图像前的图像预览jquery,jquery,html,Jquery,Html,有没有办法在IE中实现fileReader()。我搜索了很多,但没有找到任何解决方案。这是我试图实现它的代码。它在firefox和chrome中运行良好,但在IE8和IE9中不起作用 <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

有没有办法在IE中实现fileReader()。我搜索了很多,但没有找到任何解决方案。这是我试图实现它的代码。它在firefox和chrome中运行良好,但在IE8和IE9中不起作用

<!DOCTYPE html>
<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script>
        function readURL(input) {
            if (input.files && input.files[0]) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    $('#img_prev')
                        .attr('src', e.target.result)
                        .width(150)
                        .height(200);
                };

                reader.readAsDataURL(input.files[0]);
            }
        }
        </script>

        <meta charset=utf-8 />
        <title>JS Bin</title>
        <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <style>
        article, aside, figure, footer, header, hgroup,
        menu, nav, section { display: block; }
        </style>
    </head>
    <body>
        <input type='file' onchange="readURL(this);" />
        <img id="img_prev" src="#" alt="your image" />
    </body>
</html>

函数readURL(输入){
if(input.files&&input.files[0]){
var reader=new FileReader();
reader.onload=函数(e){
$('img#u prev')
.attr('src',e.target.result)
.宽度(150)
.身高(200);
};
reader.readAsDataURL(input.files[0]);
}
}
JS-Bin
文章、旁白、数字、页脚、页眉、H组、,
菜单,导航,部分{显示:块;}

是的,我只有一个解决方案。IE 9不支持文件读取器,因此我们可以禁用rest浏览器文件读取器的图像预览。它将完美工作。

你说的
不工作是什么意思?你有没有收到任何错误信息?thnx在firefox和chrome中的回复功能,但在ie图像预览中没有显示我在网络上搜索了很多内容,但没有得到任何解决方案。。。