【发布时间】:2011-11-23 13:30:56
【问题描述】:
我使用 jQuery MultiFile 插件。下面的上传按钮:
我可以将 Choose File 文本更改为其他内容吗?网上冲浪帮不了我。
我只想要一个“选择文件”。
请说*是(+以及如何)或*否。
谢谢!
【问题讨论】:
-
Labeling file upload button 的可能重复项
标签: jquery html ruby-on-rails
我使用 jQuery MultiFile 插件。下面的上传按钮:
我可以将 Choose File 文本更改为其他内容吗?网上冲浪帮不了我。
我只想要一个“选择文件”。
请说*是(+以及如何)或*否。
谢谢!
【问题讨论】:
标签: jquery html ruby-on-rails
是的,我找到了最好的解决方法!这不是 hack - 我们只需要 2 个按钮:原始按钮和“假”按钮。
<input type="button" value="Choose Files">
<input type="file">
Fake 显示给用户,并且有
z-index:1
原件位于其上方,带有
z-index:2, opacity: 0; position: relative;
并且有回调:
:onmousedown=>"buttonPush('depressed')", :onmouseup=>"buttonPush('normal')"
function buttonPush(buttonStatus) {
if (buttonStatus == "depressed")
document.getElementById("fake_btn").style.borderStyle = "inset";
else
document.getElementById("fake_btn").style.borderStyle = "outset";
}
感谢此链接 http://www.dreamincode.net/forums/topic/15621-styling-a-file-browse-button/
问候@Piskvor,@racar
【讨论】:
不,这是<input type="file">控件的一部分,网页无法控制其外观。
【讨论】: