我正在开发一个移动网站,它不是一个原生 iPhone 应用程序,而是一个用 c# asp.net 开发的简单 m.somedomain.com 网站.
I'm working on a mobile website which is NOT a native iPhone app but rather a simple m.somedomain.com website which is developed in c# asp.net .
目标:单击其中一个文本框时,如何仅显示数字键盘?
Objective : On clicking one of the text boxes how do I display the numeric keyboard only ?
注意:该网站不是 HTML5 格式,也不是本机应用程序内 web 视图的一部分,而是一个独立的常规网站
Note : The website is NOT in HTML5 and is not part of a webview inside a Native app but rather a standalone regular website
我的文本框是一个普通的 asp.net 文本框:
My textbox is a regular asp.net text box :
<asp:TextBox runat="server" CssClass="reference_input" Text="1234567" />
编辑:我找到了 这里你可以使用
EDIT: I found here that you can use
<input type="text" pattern="[0-9]*"/>
告诉移动 Safari 将数字键盘设置为默认值,无需指定电话键盘.
to tell mobile safari to set the numeric keyboard as default, without needing to specify the telephone keyboard.
EDIT 2(来自下面的评论):您也可以使用 javascript 来强制输入数字:
EDIT 2 (from comments below): You can also use javascript to force numeric input as so:
<input type="text" pattern="[0-9]*" onKeypress="if(event.keyCode < 48 || event.keyCode > 57){return false;}"/>
这篇关于Iphone Development - 如何显示数字键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在与中心点成给定角度的直线相交的 UIView 矩形上Find the CGPoint on a UIView rectangle intersected by a straight line at a given angle from the center point(在与中心点成给定角度的直线相交
是否可以使用字符串和 int 引用变量?Is it possible to reference a variable with a string and an int?(是否可以使用字符串和 int 引用变量?)
是否有适用于 iPhone 的本机 YAML 库?Is there a native YAML library for iPhone?(是否有适用于 iPhone 的本机 YAML 库?)
在 iOS 9 Shortcut Bar only 模式下,与键盘顶部对齐的View aligned to top of keyboard appears in wrong place in iOS 9 Shortcut Bar only mode(在 iOS 9 Shortcut Bar only 模式下,与键盘顶部对齐的视
以编程方式在android中的软输入键盘上禁用语音到Disable speech to text button (Micro phone) on soft input keyboard in android programmatically(以编程方式在android中的软输入键盘上禁用语
UI键盘类型UIkeyboard type(UI键盘类型)