首页 > 其他 > 详细

input file 修改按钮名称

时间:2017-06-21 17:52:40      阅读:385      评论:0      收藏:0      [点我收藏+]

解决方法:

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

input file 修改按钮名称

原文:http://www.cnblogs.com/web-Knowledge/p/7060881.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!