為什么indexOf不能在IE8數(shù)組上工作?以下功能在Opera、Firefox和Chrome上運(yùn)行良好。但是,在IE8中,它在if ( allowed.indexOf(ext[1]) == -1)部分。有人知道為什么嗎?有明顯的錯誤嗎?function CheckMe() {
var allowed = new Array('docx','xls','xlsx', 'mp3', 'mp4', '3gp', 'sis', 'sisx', 'mp3', 'wav', 'mid', 'amr', 'jpg', 'gif', 'png',
'jpeg', 'txt', 'pdf', 'doc', 'rtf', 'thm', 'rar', 'zip', 'htm', 'html', 'css', 'swf', 'jar', 'nth', 'aac', 'cab', 'wgz');
var fileinput=document.getElementById('f');
var ext = fileinput.value.toLowerCase().split('.');
if ( allowed.indexOf(ext[1]) == -1)
{
document.getElementById('uploadsec').innerHTML = document.getElementById('uploadsec').innerHTML;
alert('This file type is not allowed!');
}}
為什么indexOf不能在IE8數(shù)組上工作?
Qyouu
2019-06-24 16:25:59