根据附件的后缀名来显示相应的图标

var obj = {};
obj["dir"] = "folder"
obj["css"] = obj["txt"] = obj["js"] = "text";
obj["html"] = obj["htm"] = obj["shtml"] = obj["hta"] = "ie";
obj["xml"] = obj["xsl"] = "xml";
obj["pdf"] = "pdf";
obj["mdb"] = "msaccess";
obj["doc"] = "msword";
obj["xls"] = "msexcel";
obj["ppt"] = "mspowerpoint";
obj["exe"] = obj["dll"] = obj["sys"] = obj["bat"] = "system";
obj["zip"] = obj["rar"] = obj["gzip"] = obj["jar"] = obj["lzh"] = "archive";
obj["ini"] = obj["inf"] = "conf";
obj["csv"] = "csv";
obj["psd"] = obj["jpg"] = obj["gif"] = "image";
obj["ra"] = obj["rm"] = obj["rmvb"] = obj["mp3"] = obj["wma"] = obj["avi"] = "media";


function getAdjuctTallyImg(_para){
var _suffix = _para.substring(_para.lastIndexOf(".")+1);
var _image = obj[_suffix] ? obj[_suffix] : "unknown" ;
var _element = ""
document.write(_element);
}

你可能感兴趣的:(js)