1

我正在使用

$(upload_button).bind('change', function(event) 
{
    var files = this.files;
    alert(typeof(files));
    if(typeof(files)!='undefined')
    {


    }
});

在我的 jQuery 代码中,它在 Firefox 和 Chrome 中运行良好,但在 IE8 中运行良好(即,IE 返回未定义的files.length,而其他返回值)。那么有人知道如何解决这个问题吗?

4

2 回答 2

1

来自jQuery APIchange事件不适用于按钮,因为我假设 upload_button 是按钮。

于 2012-09-26T11:21:13.127 回答
1

这是因为 Internet Explorer,甚至 IE9都不支持 HTML5 File API,因此它返回属性undefined值。files

于 2012-09-26T11:28:46.700 回答