JS判断文件类型的方法
- 作者:网页模板
- 类型:文章教程
- 点击次数:
- 发布时间:2014-03-10 15:30
function changeType(objFile) { var objtype=objFile.substring(objFile.lastIndexOf(".")).toLowerCase(); var fileType=new Array(".ad",".adprototype",".asa",".asax",".ascx",".ashx",".asmx",".asp",".aspx",".axd",".browser",".cd",".cdx",".cer",".compiled",".config",".cs",".csproj",".dd",".exclude",".idc",".java",".jsl",".ldb",".ldd",".lddprototype",".ldf",".licx",".master",".mdb",".mdf",".msgx",".refresh",".rem",".resources",".resx",".sd"+".sdm",".sdmdocument",".shtm",".shtml",".sitemap",".skin",".soap",".stm",".svc",".vb",".vbproj",".vjsproj",".vsdisco",".webinfo"); for(var i=0; i<fileType.length; i++){ if(objtype==fileType[i]) { return false; break; } } return true; }上面代码实现了JS判断文件类型的方法,如果你上传或者文件操作的文件类型,与你定义的文件类型相同,则返回flase,否则返回true。
(责任编辑:网页模板)
- 本文标签:
- JS判断文件类型