input file 修改按鈕名稱


解決方法:

  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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM