解决代码: 提示可以利用div来覆盖file显示的字体
<div style="position: absolute;left:87px; width: 300px;background-color:white; display: block;" id="txtvalue"></div> <input type="file" id="f ncg_PM_file" onchange="valuelenth()"> //处理文件名字太长问题 function valuelenth(){ var textvalue = ""; var lens = 21;//定义字符多长换行 var fncg_PM_file = $("#fncg_PM_file").val(); if(fncg_PM_file.length > 0 ){ if(fncg_PM_file.length > lens ){ for(var i = 0,j=1; i < fncg_PM_file.length;i++,j++){ if(j && j % lens==0 ){ textvalue+= '<br/>'; textvalue+= fncg_PM_file[i]; }else{ textvalue += fncg_PM_file[i]; } } } } $("#txtvalue").css.display = "inline"; $("#txtvalue").html(textvalue); }