1 /** 2 * 选中文件名中非扩展名部分 3 * @constructor 4 * @author putaoshu@126.com 5 * @date 2012-06-14 6 * @param {Object} obj 主对象 7 * @param {String} 'all' 全部选中 8 * @require vui.selectCode 9 * @example vui.selectFileName($('#rename')); 10 */ 11 12 vui.selectFileName = function(obj,all){ 13 var filename = obj.value; 14 var lastDotPlace = filename.lastIndexOf('.'); 15 if (lastDotPlace==-1 || all == 'all'){ 16 lastDotPlace = filename.length; 17 } 18 19 //to select code 20 vui.selectCode(obj,0,lastDotPlace); 21 } 22 23