简体   繁体   English

如何更改输入类型=“文件”元素的按钮文本

[英]How to change the button text of input type=“file” element

Well I am developing a simple page in html, in which I am using input element type="file" . 我正在用html开发一个简单的页面,其中我使用input element type="file" By default we get a textbox and a button to browse a file from the system. 默认情况下,我们有一个文本框和一个按钮,用于从系统浏览文件。 Default label of this button is Browse. 此按钮的默认标签为“浏览”。 But I want to change the label of this button with some other name, like 'Open' or 'Select File'. 但是我想使用其他名称来更改此按钮的标签,例如“打开”或“选择文件”。 But I don't have any idea how to accomplish this. 但是我不知道如何实现这一目标。

Does anyone know how to do this? 有谁知道如何做到这一点?

You have to use an image and overlay it on top of the button. 您必须使用图像并将其覆盖在按钮上方。 then use Javascript to clone the file click onto the image. 然后使用Javascript克隆文件,然后单击图像。 Does this even make sense? 这有道理吗? I'm a bit hungover. 我有点宿醉。
Anyway, here's a ncie jQuery plugin http://www.appelsiini.net/projects/filestyle/demo.html 无论如何,这是一个ncie jQuery插件http://www.appelsiini.net/projects/filestyle/demo.html

You can't. 你不能 You could if you would use Flash or Java for handling file uploads. 如果可以使用Flash或Java处理文件上传,则可以。

您无法更改文件控件“浏览”文本,如果您使用jquery文件上传,则可以执行此操作...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM