• 设为首页
  • 加入收藏
  • 我要投稿
  • 联系站长
  • 网站模板技术交流
当前位置:模板网首页 > 建站教程 > JS、jQ >  JS判断文件类型的方法正文

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判断文件类型
js实现只能输入数字,输入非数字则没有效果的input框
jQuery高级动画animate()函数详解