qingdaofu

解决方法:

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

分类:

技术点:

相关文章:

  • 2022-01-08
  • 2021-12-06
  • 2022-01-08
  • 2021-11-29
  • 2021-09-29
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2021-09-07
  • 2022-01-08
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案