默认情况下使用数字键盘的Android手机中的Asp.net文本框 [英] Asp.net textbox in Android phone with numeric keyboard selected by default

查看:83
本文介绍了默认情况下使用数字键盘的Android手机中的Asp.net文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发一个常规的asp.net网站(没有Textviews),对于其中一个文本框,我默认需要打开数字键盘的文本框,有没有办法实现这一目标?

We are developing a regular asp.net website (no Textviews), for one of the text boxes I need the textbox to open a numeric keyboard by default, is there a way to achieve this?

下面的代码在iPhone/iPad上完美运行,但在Android上默认不使用数字键盘.

Below code works perfectly for iPhone / iPad but does not default to numeric keyboard for Android.

<asp:TextBox runat="server" type="number" pattern="\d*" onKeypress="if(event.keyCode < 48 || event.keyCode > 57){return false;}" />

Adroid版本:2.2.1

Adroid version : 2.2.1

当我使用type ="number"的HTML输入框时,它可以正常工作.我需要一种使用asp.Net文本框并查看数字键盘的方法.

EDIT : When I use an HTML input box with type="number" it works perfectly. I need a way to use asp.Net textbox and see the numeric keyboard.

推荐答案

这是我的解决方案:

<div style="display:none"><asp:TextBox ID="txt_Phone" runat="server" /></div>
<input onblur="document.getElementById('<%=txt_Phone.ClientID %>').value = this.value" type="tel" />

享受:)

这篇关于默认情况下使用数字键盘的Android手机中的Asp.net文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆