为什么indexOf不能在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!'); }}
波斯汪
慕少森
相关分类