我们的客户希望我们能够对输入字段中显示的数字键盘所以基本上我创建了一个领域,如:
Our client wants us to display numeric keyboard for an input field so basically I created a field like:
<输入类型=数字NAME =量的步骤=01值=0.00/>
不过,银河平板抹去。并合并号之前和之后,也将禁用。在键盘。
However, Galaxy Tablet erases "." and merges numbers before and after it, also disables "." in the keyboard.
有另一种方式来解决这个问题,或者在使用类型=文本显示的数字键盘输入字段?
Is there another way to solve this issue or display numeric keyboard in input field when using type="text"?
请注意: 我试图用模式属性(适用于iPhone)。 我与Android 2.1+各种Android设备上测试了这个问题。我没有遇到任何其他HTC和三星的设备此错误。
Note: I tried using pattern attribute (which works on iPhone). I tested this issue on various Android devices with Android 2.1+. I did not encounter this error on any other HTC and Samsung devices.
是的,还有另一种方式。
Yes, there is another way.
方法1:不使用 TYPE =号
,但使用 TYPE =文本
方法2:申请方式1只Android手机。检测用户代理等。
方法3:只破实施应用方式1。参见:What三星的智能手机型号不支持HTML5输入类型="数量和QUOT;?
路4:使用 TYPE =电话
只有Android或折断。 (不能在iPhone上使用,因为没有时间的话)
路5:使用 TYPE =文本
,然后用JavaScript的自定义行为。参见:
Way 1: don't use type="number"
but use type="text"
Way 2: Apply way 1 for only Android phones. Detect User-Agent etc.
Way 3: Apply way 1 for only broken implementations. See: What models of Samsung smartphones do not support html5 input type="number"?
Way 4: Use type="tel"'
for only Android or broken. (can't use on iPhone as no period then)
Way 5: use type="text"
and then javascript with custom behavior. See:
期总是显示: http://jsbin.com/heqeduyi/1/
周期显示,一旦3个数字: http://jsbin.com/yinaweho/1
Period shows once 3 digits: http://jsbin.com/yinaweho/1