如何使用Javascript限制图像大小对于IE 8& IE 9 [英] How To Restrict Image Size Using Javascript For IE 8 & IE 9

查看:98
本文介绍了如何使用Javascript限制图像大小对于IE 8& IE 9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTML5大小检查API,它在除IE8和IE9之外的所有浏览器中都能正常工作。我收到此错误:SCRIPT5007:无法获取属性'0'的值:对象为null或未定义。在IE8和IE9中,因为IE8和IE9不支持[0]这种语法。



HTML5文件大小API代码:

I am using HTML5 size checking API, it is working fine in all browser except IE8 and IE9. I am getting this error : "SCRIPT5007: Unable to get value of the property '0': object is null or undefined." in IE8 and IE9, because IE8 and IE9 do not support "[0]" this syntax.

HTML5 File Size API Code:

if (img.files[0].size < 524288) {
  return true;
}





无论如何在IE8和IE9中使用Javascript检查图像文件大小。如果有人知道如何使用javascript限制图像大小,那么请给我一些想法。



Is there anyway to check image file size using Javascript in IE8 and IE9. If anyone know how to restrict image size using javascript then please give me some idea.

推荐答案

只要我知道没有办法在ie< 10.由于他们没有实现文件api http://caniuse.com/#search=file%20api [ ^ ]
As long as i know there is no way of doing this in ie < 10. Since they don't implement the file api http://caniuse.com/#search=file%20api[^]


这篇关于如何使用Javascript限制图像大小对于IE 8&amp; IE 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆