Internet Explorer 中 onchange 事件时没有发出警报?
我使用下面的代码:
<input type="file" onChange="readURL(this)" />
<script src="http://code.jquery.com/jquery-1.8.0.min.js " > </script>
<script>
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
alert('asf');
reader.onload = function(e) {
//alert(e.target.result);
$('#photoview').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
</script>
最佳答案
IE9没有FileReader。
请参阅 this MDN documentation 末尾的兼容性表。请注意,本文档还提出了与 IE 兼容的解决方案。
关于javascript - jQuery 警报在 onchange 上的 ie 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13703492/