允许用户键入输入类型文件。 [英] Allow the user to type in input type file.

查看:90
本文介绍了允许用户键入输入类型文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我的代码,



< input id =txtfiletype =file/>



我希望该用户也可以在该文本框中键入文本。在我的方案中,当光标移动到

时,该文件对话框中的文本框(txtfile)打开。我想要通过单击浏览按钮来避免文件对话框打开

Here my code,

<input id="txtfile" type="file" />

And i want that user also can type a text in that textbox.In my scenario when cursor moves to
the textbox ("txtfile") in that file dialog box open.I want to avoid that the file dialog will
open only by clicking browse button.

推荐答案

类型文件的html控件以不同方式显示每个浏览器。所以(我认为)的方法是添加文件控件并隐藏它。然后你可以添加一个文本框和一个按钮,并尝试完成相同的操作。这是一个jsfiddle就是这样做的!



http://jsfiddle.net/ CcGrT /



但是好奇,你为什么要这样做?这只会让你的生活变得更加艰难,因为你不知道输入的内容是否有效。所以我也会禁用文本框,让按钮单独处于启用状态!



希望这有帮助!如果这不是你要找的那个。更新你的问题!
A html control of type "file" is displayed differently by every browser. So the way to go (I think) would be to add the file control and hide it. Then you could add a text box and a button and try to accomplish the same. Here is a jsfiddle that does just that!

http://jsfiddle.net/CcGrT/

But just curious, why do you want to do this? This just makes your life tougher, since you wouldn't know if anything entered is valid. So I would also disable the text box, leaving the button alone to be in the enabled state!

Hope this helps! If this is not what you're looking for pls. update your question!


这篇关于允许用户键入输入类型文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆