Created
November 27, 2013 10:19
-
-
Save yangjunjun/7673516 to your computer and use it in GitHub Desktop.
根据不同的后缀名,返回相应的后缀类别。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getSuffixIcon = function(type){ | |
var icon ='unknow'; | |
var suffix = { | |
image:['jpg','png','gif','jpeg'], | |
doc:['doc','docx'], | |
rar:['rar','zip','tar','gz','7z','tar.gz'], | |
xls:['csv','xls'] | |
} | |
for(var k in suffix){ | |
if($.inArray(type, suffix[k]) > -1){ | |
icon = k; | |
} | |
} | |
return icon; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment