您能否向移动设备提供 HTML 输入字段仅包含数字的提示?

发布于 2024-09-16 22:44:20 字数 172 浏览 3 评论 0原文

我一直在使用 Android 手机和 iPod touch 对我正在开发的网站进行一些可用性测试。在这两种情况下,当输入数字字段(时间、距离(以米为单位)等)时,我必须手动更改键盘布局以显示数字。由于该应用程序仅接受文本框中的数字值,因此我想避免给用户带来不便,并告诉设备“切换到数字键盘进行此输入”。

这可能吗?

I've been doing some usability testing on a website I'm developing, using an Android phone and an iPod touch. In both cases, when entering a numeric field (time, distance in metres, etc) I have to take a manual step to change the keyboard layout to show digits. As the app will only accept numeric values in the textbox, I'd like to save the user the inconvenience and tell the device "switch to the number pad for this input".

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉睡月亮 2024-09-23 22:44:20

经过一番浏览后,HTML 5 似乎为此提供了一些答案,尽管它们并未得到广泛支持。

具体来说,数字类型输入

<input type="number"
       min="0"
       max="10"
       step="2"
       value="6">

这是一个演示。适用于 Chrome 6.0.472.51(测试版)。尚未在 Android/iPhone 上进行测试,但显然它可以工作。


(来源:wearehugh.com

After some browsing, it seems that HTML 5 offers some answers for this, though they're not widely supported.

Specifically, the number type input:

<input type="number"
       min="0"
       max="10"
       step="2"
       value="6">

Here's a demo. Works on Chrome 6.0.472.51 (beta). Have yet to test on Android/iPhone but apparently it works.


(source: wearehugh.com)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文