2014-04-18 57 views

回答

0

你可以尝试这样的事情(变通

<input type="text" id="fileName" readonly="readonly" > 
</br> 
<small>Here change this with whatever dynamically</small> 
</br> 
<div class="file_input_div" style="display: inline;"> 
<input type="button" id="button" value="Open"/> 
<input type="file" style="opacity:0; position:relative; left:-40px;" onchange="javascript: document.getElementById ('fileName').value = this.value"/> 
</div> 

DEMO

编辑2

<small id='fileName'>Here change this with whatever dynamically</small> 
</br> 
<div class="file_input_div" style="display: inline;"> 
<input type="button" id="button" value="Open"/> 
<input type="file" style="opacity:0; position:relative; left:-40px;" onchange="javascript: document.getElementById('fileName').innerHTML = this.value"/> 
</div> 

DEMO 2

+0

其实我希望我上传的文件名显示在文件字段中,以便如果用户在编辑其他字段时不选择新文件并且不改变文件字段,则不应该要求文件字段(选择文件),并且旧的填充文件名是在表中更新。 – RJ007

+0

@ user2821027检查我的更新答案 –

相关问题