页面:
<span class="sl-custom-file">
<a href="#" class="btn btn-green" id="selectFile4" >选择文件</a>
<input type="file" name="uploadImage" id="uploadFile4" value="选择" onblur="clickFile(4)" title="文件小于10M" class="ui-input-file"/>
<div title="正在上传,请耐心等待"></div>
</span>
css:
<style type="text/css">
.sl-custom-file{position:relative;display:inline-block;zoom:1;cursor:pointer;overflow:hidden;vertical-align:middle;}
.sl-custom-file .ui-input-file{position:absolute;right:0;top:0;_zoom:30;font-size:300px\9;height:100%;_height:auto;opacity:0;filter:alpha(opacity=0);-ms-filter:"alpha(opacity=0)";cursor:pointer;}
</style>
参考网站:http://jsfiddle.net/HMVTF/
来源:https://www.cnblogs.com/daisyleamo/archive/2013/06/04/3117492.html