如何将浏览按钮重命名为“选择文件”?例如:
<input type=file name=browse >
最佳答案
<script language="JavaScript" type="text/javascript">
function HandleBrowseClick()
{
var fileinput = document.getElementById("browse");
fileinput.click();
}
function Handlechange()
{
var fileinput = document.getElementById("browse");
var textinput = document.getElementById("filename");
textinput.value = fileinput.value;
}
</script>
<input type="file" id="browse" name="fileupload" style="display: none" onChange="Handlechange();"/>
<input type="text" id="filename" readonly="true"/>
<input type="button" value="Click to select file" id="fakeBrowse" onclick="HandleBrowseClick();"/>
关于html - 如何重命名输入类型=文件的 HTML "browse"按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1163667/