当前位置:
代码迷
>>
综合
>> 兼容安卓系统9的虚拟定位
详细解决方案
兼容安卓系统9的虚拟定位
热度:
18
发布时间:
2023-09-08 05:54:02.0
兼容安卓系统9的虚拟定位
<body> 最大数: 98765<input type=text value='123456' name=tt onkeydown=numInputCheck(this,98765)>具体功能自己测试咯 :) </body> <script> /* 只允许输入数字 */ function numInputCheck(o,m){ var d; if(',48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105,8,9,13,'.indexOf(',' + event.keyCode + ',')==-1){ event.returnValue=null; } if(m!=null){ d = event.keyCode >= 96 ? event.keyCode - 48 : event.keyCode; if(document.selection.createRange().duplicate().text=='' && (o.value+String.fromCharCode(d))>m){ event.returnValue=null;o.value=m; }else if(',8,9,13,'.indexOf(',' + d + ',')==-1&&document.selection.createRange().duplicate().text==''&&o.value.indexOf('0')==0){ o.value=''; } } } </script>
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
兼容安卓系统9的虚拟定位
查看全文
相关解决方案