html:file 中把浏览按钮变成英文

来源:互联网 发布:nuitka windows 编辑:程序博客网 时间:2024/04/29 02:02

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=formen>  <input type="file" name="picpath" id="picpath" style="display:none" onChange="document.formen.path.value=this.value">  <input name="path" readonly> <input type="button" value="Browse" onclick="document.formen.picpath.click()"> </form>