The below function works fine on opera, firefox and chrome. However in IE8 it fails on if ( allowed.indexOf(ext[1]) == -1)
part.
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!');
}
}