Home > Web Front-end > JS Tutorial > JS input digital verification code_javascript skills

JS input digital verification code_javascript skills

WBOY
Release: 2016-05-16 18:48:59
Original
1100 people have browsed it

/*
**@The control can only input numbers, including - (negative sign). (decimal point)
**@Inline HTML: For Input
**@Event property: object. attachEvent("onkeypress",onlyNumber);object.style.imeMode = "disabled";
**@Author:wangwq@atools
*/
function onlyNumber(){
if(!( ((window.event.keyCode >= 48) && (window.event.keyCode || (window.event.keyCode == 13) || (window.event.keyCode == 46)
|| (window.event.keyCode == 45))){
window.event.keyCode = 0 ;
}
}
// This function is used to limit the text input box Only numbers "0" to "9" can be entered in
//@Inline HTML: For Input
//@Event property: object.attachEvent("onkeypress",JHshNumberText);object.style. imeMode = "disabled";
function JHshNumberText()
{
if ( !(((window.event.keyCode >= 48) && (window.event.keyCode {
window.event.keyCode = 0 ;
}
}

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template