这段 javascript 代码仅适用于 IE 为什么以及如何使其在 Firefox 和 chrome 上运行。提前致谢。
Javascript
function uploadFileChange() {
if (document.getElementById('textbox1').value != document.getElementById("FileUpload1").value) {
document.getElementById('textbox1').value = document.getElementById("FileUpload1").value;
}
return false;
}
HTML/asp.net
<div class="fileinputs">
<!-- Upload file invisivel-->
<asp:FileUpload ID="FileUpload1" ClientIDMode="Static" class="file" runat="server"
onpropertychange="uploadFileChange();" />
<!-- button e textbox falsas para poder dar syles ao button-->
<div class="fakefile">
<asp:TextBox ID="textbox1" CssClass="textbox" ClientIDMode="Static" runat="server"
Width="31%" ReadOnly="true" />
<asp:Button ID="FileChooserButton1" CssClass="btnSubmit" runat="server" Text="Procurar..."
ForeColor="White" />
<asp:Button ID="FileChooserButton2" CssClass="btnSubmit" Text="Apagar" ForeColor="White"
OnClientClick="clear();" runat="server" />
</div>
</div>
解决