Home >Web Front-end >JS Tutorial >js prohibits numeric function code input on the small keyboard_javascript skills

js prohibits numeric function code input on the small keyboard_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:04:021052browse
Copy code The code is as follows:

function isNum()//Judge the number entered on the small keyboard
{
var str=(window.event.keyCode);
if(str>105 || str<96 )
{
if (str!=8 )
{
window .event.returnValue=false;
return;
}
}
}
function isNumUp()//Judge the main keyboard input number
{
var str=(window .event.keyCode);
if(str>57 || str<48 )
{
if (str!=8 )
{
window.event.returnValue=false;
return;
}
}
}


Test code:
Copy code The code is as follows:
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn