The below function works fine on Opera, Firefox and Chrome.(以下功能在Opera,Firefox和Chrome上正常运行。)
However, in IE8 it fails on theif ( allowed.indexOf(ext[1]) == -1)
part.(但是,在IE8中,它在if ( allowed.indexOf(ext[1]) == -1)
部分失败。)
Does anyone know why?(有人知道为什么吗?) Is there any obvious mistake?(有没有明显的错误?)
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!');
}
}
ask by nLL translate from so