这里不允许使用十进制。请帮助 [英] Decimal is not allowed here. Kindly help

查看:71
本文介绍了这里不允许使用十进制。请帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">
    $(function() {
    $('.textBox_for6tds').keydown(function(e) {
            if (e.shiftKey || e.ctrlKey || e.altKey) {
                e.preventDefault();
            } else {
                var key = e.keyCode;
                if (!((key == 8)  || (key == 46) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)))

                {

                    e.preventDefault();

                    alert("Please enter numeric value!");



                }

            }

        });

    });







- 一切正常。

- 但如果我想进入43.53

- 。如果我进入它不允许我做.......

- ascii of。(十进制)。或者如何处理这个。




--everything is working fine.
--but if i want to enter 43.53
--the . if i enter its not allowing me to do.......
--what is the ascii of .(decimal). Or how to handle this.

推荐答案

(function(){
(function() {


('。textBox_for6tds')。keydown(function( e){
if(e.shiftKey || e.ctrlKey || e.altKey){
e.preventDefault();
} else {
var key = e。 keyCode;
if(!((key == 8)||(key == 46)||(key> = 35&& key < = 40) || (key > = 48&& key < = 57) || (密钥 > = 96&& key < = 105)))

{

e.preventDefault();

< span class =code-attribute> < span class =code-attribute> alert(请 输入 数字 value!);



< span class =code-attribute> }

}

});

});
('.textBox_for6tds').keydown(function(e) { if (e.shiftKey || e.ctrlKey || e.altKey) { e.preventDefault(); } else { var key = e.keyCode; if (!((key == 8) || (key == 46) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105))) { e.preventDefault(); alert("Please enter numeric value!"); } } }); });







- 一切正常。

- 但如果我想进入43.53

- 。如果我进入它不允许我做.......

- ascii of。(十进制)。或者如何处理这个。




--everything is working fine.
--but if i want to enter 43.53
--the . if i enter its not allowing me to do.......
--what is the ascii of .(decimal). Or how to handle this.






数字小键盘部分中的点ASCII值是46.但是点在一般关键的ascii值是190.



if(!((key == 8)||(key == 46)||(key == 190) ||(键> = 35&& key< = 40)||(键> = 48&&键< = 57)||(键> = 96&&键< ; = 105)))

{

e.preventDefault();

alert(请输入数值!);



}
Hi,

The dot in numeric keypad section ASCII value is 46. But the dot in general the key ascii value is 190.

if (!((key == 8) || (key == 46) || (key == 190) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)))
{
e.preventDefault();
alert("Please enter numeric value!");

}


这篇关于这里不允许使用十进制。请帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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