var suffix = name.substring(name.lastIndexOf("."));//.txt
/*只获取后缀*/
var suffix =name.substring(name.lastIndexOf(".")+1);//txt