码迷,mamicode.com
首页 > Web开发 > 详细

HTML input file中把浏览按钮变成英文

时间:2020-03-21 21:09:25      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:hang   doc   row   this   文本   调用   选择   one   只读   

1、页面上放个隐藏的<input type="file" />
2、然后加上一个文本<input type="text" />和一个按钮<input type="button" />
3、点按钮的时候调用<input type="file" />的click选择文件
4、在<input type="file" />的onchange事件中把其值显示在文本input中
5、注意把文本input设置成只读的,防止出错
<form name="form_en">
<input type="file" name="picpath" id="picpath" style="display:none" onChange="document.form_en.path.value=this.value">
<input name="path" readonly> 
<input type="button" value="Browse" onclick="document.form_en.picpath.click()"> 
</form>

HTML input file中把浏览按钮变成英文

标签:hang   doc   row   this   文本   调用   选择   one   只读   

原文地址:https://www.cnblogs.com/chobittsu/p/12541989.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!