HTML代码
<div id="container" title="Choose File">
<div id="doit">
<img id="blah" src="#" alt="your image" />
<div id="preview_ie">
hijjjj
</div>
</div>
<input id="hid" type="file" size=1 onchange="readURL(this);" >
</div>
JQuery并添加jquery
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new window.FileReader();
reader.onload = function (e) {
$('#blah')
.attr('src', e.target.result)
.width(150)
.height(200);
};
reader.readAsDataURL(input.files[0]);
}
console.log(input.value);
var newPreview = document.getElementById('preview_ie');
document.getElementById('preview_ie').filter.item("DXImageTransform.Microsoft.AlphaImageLoader").src = input.value;
document.getElementById('preview_ie').filter.item("DXImageTransform.Microsoft.AlphaImageLoader").sizingMethod="scale";
document.getElementById('preview_ie').style.width = "160px";
document.getElementById('preview_ie').style.height = "120px";
}
</script>
上面使用的代码所有浏览器显示图像但不显示IE9.file上传控件隐藏此控件单击打开浏览器图像并上传但不显示在IE9中