如何在iPhone Web应用程序中显示数字键盘?

时间:2022-08-24 09:20:14

On a web page that is to be displayed on an iPhone, is there a way to get the number pad to come up when the user taps in the field, instead of the qwerty keypad?

在要在iPhone上显示的网页上,当用户点击字段而不是qwerty键盘时,是否有办法让数字键盘出现?

This guy says here's how to do it, but as of 2.0, this "feature" was disabled.

这家伙说这是怎么做的,但从2.0开始,这个“功能”被禁用了。

I'm guessing there's some fancy javascript to employ to get around this limitation?

我猜这里有一些花哨的javascript来解决这个限制?

3 个解决方案

#1


2  

If you use the HTML5 number input type, the keyboard will default to showing numbers. It's not the number-only keyboard, but it's a bit better than just text.

如果使用HTML5数字输入类型,键盘将默认显示数字。它不是仅限数字的键盘,但它比文本更好一些。

#2


1  

Yes, this used to be possible by including the word "zip" in your text field's name attribute. Unfortunately, Apple seems to have removed this in 2.0 and later. I suggest you file a bug.

是的,过去可以通过在文本字段的name属性中包含单词“zip”来实现。不幸的是,Apple似乎已经在2.0及更高版本中删除了它。我建议你提交一个bug。

#3


0  

You can make calls from JavaScript to Objective-C and then display what ever you want. If you want a framework to help you out you could check out QuickConnectiPhone. It is available at https://sourceforge.net/projects/quickconnect/.

您可以从JavaScript调用Objective-C,然后显示您想要的内容。如果您想要一个框架来帮助您,您可以查看QuickConnectiPhone。它可以在https://sourceforge.net/projects/quickconnect/上找到。

You could also check out http://tetontech.wordpress.com. This is the develpment blog for QuickConnect. It has some example code in addition to that which is included in the sourceforge download.

你也可以看看http://tetontech.wordpress.com。这是QuickConnect的开发博客。它除了包含在sourceforge下载中的代码之外还有一些示例代码。

#1


2  

If you use the HTML5 number input type, the keyboard will default to showing numbers. It's not the number-only keyboard, but it's a bit better than just text.

如果使用HTML5数字输入类型,键盘将默认显示数字。它不是仅限数字的键盘,但它比文本更好一些。

#2


1  

Yes, this used to be possible by including the word "zip" in your text field's name attribute. Unfortunately, Apple seems to have removed this in 2.0 and later. I suggest you file a bug.

是的,过去可以通过在文本字段的name属性中包含单词“zip”来实现。不幸的是,Apple似乎已经在2.0及更高版本中删除了它。我建议你提交一个bug。

#3


0  

You can make calls from JavaScript to Objective-C and then display what ever you want. If you want a framework to help you out you could check out QuickConnectiPhone. It is available at https://sourceforge.net/projects/quickconnect/.

您可以从JavaScript调用Objective-C,然后显示您想要的内容。如果您想要一个框架来帮助您,您可以查看QuickConnectiPhone。它可以在https://sourceforge.net/projects/quickconnect/上找到。

You could also check out http://tetontech.wordpress.com. This is the develpment blog for QuickConnect. It has some example code in addition to that which is included in the sourceforge download.

你也可以看看http://tetontech.wordpress.com。这是QuickConnect的开发博客。它除了包含在sourceforge下载中的代码之外还有一些示例代码。