Javascript 在输入焦点上打开数字版本的windows 10触摸键盘

Javascript 在输入焦点上打开数字版本的windows 10触摸键盘,javascript,php,jquery,html,windows,Javascript,Php,Jquery,Html,Windows,我已经为自助前台创建了一个网站。 显示此网站的计算机只有一个触摸屏。没有硬件键盘或鼠标。只需触摸屏即可。 您可以选择要会见的员工 这将打开一个包含3个输入字段的表单:姓名、电话号码和电子邮件 我希望当用户单击电话号码输入字段时,屏幕上的数字键盘弹出 对于手机,我会使用以下任一选项: type="text" pattern="\d*" type="number" pattern="[0-9]*" inputmode="numeric" 但对于Windows 10屏幕键盘,这不起作用。 有没有办法

我已经为自助前台创建了一个网站。
显示此网站的计算机只有一个触摸屏。没有硬件键盘或鼠标。只需触摸屏即可。
您可以选择要会见的员工
这将打开一个包含3个输入字段的表单:姓名、电话号码和电子邮件

我希望当用户单击电话号码输入字段时,屏幕上的数字键盘弹出

对于手机,我会使用以下任一选项:

type="text" pattern="\d*"
type="number" pattern="[0-9]*" inputmode="numeric"
但对于Windows 10屏幕键盘,这不起作用。
有没有办法强制打开数字键盘?
我只在谷歌浏览器上测试过这个。也许其他浏览器可以更好地处理这个问题。
也许这是不可能的


欢迎使用替代方法。

如果在Windows上无法使用,则有一种替代方法:
证明:
我使用jQuery虚拟键盘重新创建了Windows10版本的屏幕键盘。您可以选择显示哪些键,并创建自己的numpad版本。

html

<input type="text" id="phone" name="iauysdyd" maxlength="7" minlength="7" class="form-control required" data-error="Ritaðu símanúmer" placeholder="PhoneNumber" autocomplete="off" required>

最后是一些CSS,使其看起来像Windows 10版的OSK:

body .ui-keyboard-input {
    text-align: center !important;
}
.ui-keyboard.ui-widget {
    bottom: 0%;
    left: 0;
    top: unset !important;
    position: absolute;
    width: 100%;
    background-color: #303030;
    background-size: 100%;
}

.ui-keyboard.ui-widget .ui-keyboard-button {
    font-size:1.4em;
    height: 2em;
    min-width: 2em;
    font-weight: 100;
    color: #fff;
}
button.ui-keyboard-button {
    background: #5d5d5d;
    border: 0px;
}
.ui-keyboard-shift span {
  background: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20id%3D%22Capa_1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20525.153%20525.153%22%20style%3D%22enable-background%3Anew%200%200%20525.153%20525.153%3B%22%20xml%3Aspace%3D%22preserve%22%20width%3D%22512%22%20height%3D%22512%22%20class%3D%22%22%3E%3Cg%3E%3Cg%3E%0A%09%3Cpath%20d%3D%22M169.974%2C401.567H355.2V216.21h123.586L262.576%2C0L46.367%2C216.21h123.586v185.357H169.974z%20M46.367%2C463.294h432.419v61.859%20%20%20H46.367V463.294z%22%20data-original%3D%22%23000000%22%20class%3D%22active-path%22%20style%3D%22fill%3A%23FFFFFF%22%20data-old_color%3D%22%23DAA3A3%22%3E%3C%2Fpath%3E%0A%3C%2Fg%3E%3C%2Fg%3E%20%3C%2Fsvg%3E') center center no-repeat;
    background-size: 20px;
    display: block;
    margin: auto;
    width: 30px;
    height: 30px;
    text-indent: -999em;
}
/* target greek letter alpha */
.ui-keyboard-bksp span {
    background: url('data:image/svg+xml;utf8,%3Csvg%20version%3D%221.1%22%20id%3D%22Capa_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20viewBox%3D%220%200%20489.425%20489.425%22%20style%3D%22enable-background%3Anew%200%200%20489.425%20489.425%3B%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cg%3E%0A%09%09%3Cpath%20style%3D%22fill%3A%23fff%3B%22%20d%3D%22M122.825%2C394.663c17.8%2C19.4%2C43.2%2C30.6%2C69.5%2C30.6h216.9c44.2%2C0%2C80.2-36%2C80.2-80.2v-200.7c0-44.2-36-80.2-80.2-80.2h-216.9%0A%09%09%09c-26.4%2C0-51.7%2C11.1-69.5%2C30.6l-111.8%2C121.7c-14.7%2C16.1-14.7%2C40.3%2C0%2C56.4L122.825%2C394.663z%20M29.125%2C233.063l111.8-121.8%0A%09%09%09c13.2-14.4%2C32-22.6%2C51.5-22.6h216.9c30.7%2C0%2C55.7%2C25%2C55.7%2C55.7v200.6c0%2C30.7-25%2C55.7-55.7%2C55.7h-217c-19.5%2C0-38.3-8.2-51.5-22.6%0A%09%09%09l-111.7-121.8C23.025%2C249.663%2C23.025%2C239.663%2C29.125%2C233.063z%22%2F%3E%0A%09%09%3Cpath%20style%3D%22fill%3A%23fff%3B%22%20d%3D%22M225.425%2C309.763c2.4%2C2.4%2C5.5%2C3.6%2C8.7%2C3.6s6.3-1.2%2C8.7-3.6l47.8-47.8l47.8%2C47.8c2.4%2C2.4%2C5.5%2C3.6%2C8.7%2C3.6s6.3-1.2%2C8.7-3.6%0A%09%09%09c4.8-4.8%2C4.8-12.5%2C0-17.3l-47.9-47.8l47.8-47.8c4.8-4.8%2C4.8-12.5%2C0-17.3s-12.5-4.8-17.3%2C0l-47.8%2C47.8l-47.8-47.8%0A%09%09%09c-4.8-4.8-12.5-4.8-17.3%2C0s-4.8%2C12.5%2C0%2C17.3l47.8%2C47.8l-47.8%2C47.8C220.725%2C297.263%2C220.725%2C304.962%2C225.425%2C309.763z%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E') center center no-repeat;
    background-size: 40px;
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
    text-indent: -999em;
}
.ui-keyboard-bksp {
    width: 103px;
}
/* needed for inline image (second method below) */
.ui-keyboard-button {
  vertical-align: middle;
}
您可能可以制作一些动画,使键盘像在windows 10上一样向上滑动。
这将使您在重新创建Windows 10 osk的精确副本方面有很长的路要走。

符合标准的移动浏览器通常根据
输入
字段的
类型
属性来确定要显示哪个键盘,但这可能是一种仅限移动的功能。自从你在Windows10上试用Chrome以来,你有没有试过在移动设备上使用Chrome(只是为了排除其他问题)?我认为这可能不是问题,更像是桌面与移动设备的较量
body .ui-keyboard-input {
    text-align: center !important;
}
.ui-keyboard.ui-widget {
    bottom: 0%;
    left: 0;
    top: unset !important;
    position: absolute;
    width: 100%;
    background-color: #303030;
    background-size: 100%;
}

.ui-keyboard.ui-widget .ui-keyboard-button {
    font-size:1.4em;
    height: 2em;
    min-width: 2em;
    font-weight: 100;
    color: #fff;
}
button.ui-keyboard-button {
    background: #5d5d5d;
    border: 0px;
}
.ui-keyboard-shift span {
  background: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%20id%3D%22Capa_1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20525.153%20525.153%22%20style%3D%22enable-background%3Anew%200%200%20525.153%20525.153%3B%22%20xml%3Aspace%3D%22preserve%22%20width%3D%22512%22%20height%3D%22512%22%20class%3D%22%22%3E%3Cg%3E%3Cg%3E%0A%09%3Cpath%20d%3D%22M169.974%2C401.567H355.2V216.21h123.586L262.576%2C0L46.367%2C216.21h123.586v185.357H169.974z%20M46.367%2C463.294h432.419v61.859%20%20%20H46.367V463.294z%22%20data-original%3D%22%23000000%22%20class%3D%22active-path%22%20style%3D%22fill%3A%23FFFFFF%22%20data-old_color%3D%22%23DAA3A3%22%3E%3C%2Fpath%3E%0A%3C%2Fg%3E%3C%2Fg%3E%20%3C%2Fsvg%3E') center center no-repeat;
    background-size: 20px;
    display: block;
    margin: auto;
    width: 30px;
    height: 30px;
    text-indent: -999em;
}
/* target greek letter alpha */
.ui-keyboard-bksp span {
    background: url('data:image/svg+xml;utf8,%3Csvg%20version%3D%221.1%22%20id%3D%22Capa_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%0A%09%20viewBox%3D%220%200%20489.425%20489.425%22%20style%3D%22enable-background%3Anew%200%200%20489.425%20489.425%3B%22%20xml%3Aspace%3D%22preserve%22%3E%0A%3Cg%3E%0A%09%09%3Cpath%20style%3D%22fill%3A%23fff%3B%22%20d%3D%22M122.825%2C394.663c17.8%2C19.4%2C43.2%2C30.6%2C69.5%2C30.6h216.9c44.2%2C0%2C80.2-36%2C80.2-80.2v-200.7c0-44.2-36-80.2-80.2-80.2h-216.9%0A%09%09%09c-26.4%2C0-51.7%2C11.1-69.5%2C30.6l-111.8%2C121.7c-14.7%2C16.1-14.7%2C40.3%2C0%2C56.4L122.825%2C394.663z%20M29.125%2C233.063l111.8-121.8%0A%09%09%09c13.2-14.4%2C32-22.6%2C51.5-22.6h216.9c30.7%2C0%2C55.7%2C25%2C55.7%2C55.7v200.6c0%2C30.7-25%2C55.7-55.7%2C55.7h-217c-19.5%2C0-38.3-8.2-51.5-22.6%0A%09%09%09l-111.7-121.8C23.025%2C249.663%2C23.025%2C239.663%2C29.125%2C233.063z%22%2F%3E%0A%09%09%3Cpath%20style%3D%22fill%3A%23fff%3B%22%20d%3D%22M225.425%2C309.763c2.4%2C2.4%2C5.5%2C3.6%2C8.7%2C3.6s6.3-1.2%2C8.7-3.6l47.8-47.8l47.8%2C47.8c2.4%2C2.4%2C5.5%2C3.6%2C8.7%2C3.6s6.3-1.2%2C8.7-3.6%0A%09%09%09c4.8-4.8%2C4.8-12.5%2C0-17.3l-47.9-47.8l47.8-47.8c4.8-4.8%2C4.8-12.5%2C0-17.3s-12.5-4.8-17.3%2C0l-47.8%2C47.8l-47.8-47.8%0A%09%09%09c-4.8-4.8-12.5-4.8-17.3%2C0s-4.8%2C12.5%2C0%2C17.3l47.8%2C47.8l-47.8%2C47.8C220.725%2C297.263%2C220.725%2C304.962%2C225.425%2C309.763z%22%2F%3E%0A%3C%2Fg%3E%0A%3C%2Fsvg%3E') center center no-repeat;
    background-size: 40px;
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
    text-indent: -999em;
}
.ui-keyboard-bksp {
    width: 103px;
}
/* needed for inline image (second method below) */
.ui-keyboard-button {
  vertical-align: middle;
}