gpt4 book ai didi

IE8 和 IE9 上的 Javascript 错误

转载 作者:数据小太阳 更新时间:2023-10-29 05:04:17 25 4
gpt4 key购买 nike

我在 IE8 和 IE9 上遇到“this.0.files.0”为空或不是对象错误,Chrome 和 Mozila 不会抛出任何错误。

$(function()) {
var fileType = ['txt' , 'csv' ];
$('.input_file').find('input [type = "file" ]').live('change', function (e)) {
$this = $(this)
var ext = $this.val() === " " ? " " : this.value.match(/\.(.+)$/)[1];
if($this.val()) {
$this.parent().find('label').text.($this[0].files[0].name)
}
}
}

我不确定为什么上面的代码会抛出 javascript 错误 'this.0.files.0' is null or not an object

最佳答案

IE < 10 不支持 html5 文件 API,即不支持 HTMLInputElement.FileList,您必须解析 HTMLInputElement.value 才能获取文件名。

关于IE8 和 IE9 上的 Javascript 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16255636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com