简体   繁体   English

覆盖网站上文本输入区域的默认移动设备键盘吗? (HTML / JS / jQuery的)

[英]Override default mobile device keyboard for text input area on website? (HTML/JS/jQuery)

I have been given a task, which up to this point I think might be impossible. 我已经完成了一项任务,到目前为止,我认为这是不可能的。 I am wondering if it is at all possible to override a default system keyboard for input in a text input area (on mobile devices). 我想知道是否有可能覆盖默认的系统键盘以在文本输入区域(在移动设备上)进行输入。

Assume the OS is Android. 假设操作系统是Android。 Is there a way for a mobile website to not show the default system keyboard when clicking on a text input area? 单击文本输入区域时,移动网站是否可以不显示默认系统键盘? I know a little bit about programming, so I know this is possible with Java inside of an app, but that's beyond the scope of this particular issue. 我对编程有所了解,因此我知道使用应用程序内的Java可以实现此功能,但这超出了此特定问题的范围。

IE, say you have a numeric input field on a website. IE,例如,您在网站上有一个数字输入字段。 Can you instead use some form of Javascript (like onFocus, onBlur, etc.) or media queries to display a custom pop-up keypad for data entry and somehow tell the device not to display it's default text entry method? 您是否可以改用某种形式的Javascript(如onFocus,onBlur等)或媒体查询来显示用于数据输入的自定义弹出键盘,并以某种方式告诉设备不要显示其默认文本输入方法?

There are a few other issues I've read regarding a jQuery datepicker where it is possible to hide the keyboard by making the element read-only or similar, but the problem is that my element still needs to be able to accept an input. 关于jQuery datepicker,我还阅读了其他一些问题,可以通过将元素设置为只读或类似方式来隐藏键盘,但问题是我的元素仍然需要能够接受输入。

The only other similar issue I've found is here . 我发现的唯一其他类似问题在这里 Alas, it also has no answer. las,它也没有答案。

For what it's worth, this task is math-related, where the pop-up keypad entry will provide limited answer entry possibilities that pertain only to the question, whereas a full keyboard is not needed and often overkill for the task at hand. 就其价值而言,此任务与数学有关,其中弹出式键盘输入将提供仅与问题相关的有限答案输入可能性,而不需要完整的键盘,并且对于手头的任务通常会造成过大的杀伤力。

EDIT: also, forcing a pure numeric input keyboard is not an acceptable solution, since the input (in some cases) will require fraction bars and/or variables, such as x and y . 编辑:同样,强制使用纯数字输入键盘也不是可接受的解决方案,因为输入(在某些情况下)将需要分数条和/或变量,例如xy

You can mark your input field read only in modern browsers, eg 您可以将输入字段标记为仅在现代浏览器中为只读

<input name="TextBox1" type="text" id="TextBox1" readonly="readonly" />

You can set a focus and cursor, but not edit this input (no default menu will popup). 您可以设置焦点和光标,但不能编辑此输入(不会弹出默认菜单)。 Now you can built your custom keyboard and use js to set the corresponding value. 现在,您可以构建自定义键盘,并使用js设置相应的值。 Sounds quite easy, but it's not- you have to make sure the input field stays visible during input and therefor maybe have to rethink your page layout. 听起来很容易,但是并非如此-您必须确保输入字段在输入过程中保持可见,因此可能不得不重新考虑页面布局。

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

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