Home >Web Front-end >JS Tutorial >js restricts input to numbers, letters, Chinese characters, etc._javascript skills

js restricts input to numbers, letters, Chinese characters, etc._javascript skills

WBOY
WBOYOriginal
2016-05-16 17:08:201125browse
Copy code The code is as follows:



1. Only numeric codes can be entered in the text box (decimal points cannot be entered either)
Copy code The code is as follows:



2. Only You can enter numbers and decimal points.
Copy code The code is as follows:




3. Numbers And decimal point method two
Copy code The code is as follows:



4. Only letters and Chinese characters can be entered
Copy code The code is as follows:



5. Only English letters and numbers can be entered, but Chinese cannot be entered
Copy the code The code is as follows:



6. Only numbers and English can be entered
Copy code The code is as follows:



7. Only after the decimal point There can be up to two digits (numbers and Chinese can be entered), letters and arithmetic symbols cannot be entered:
Copy code The code is as follows:

57) &&event.keyCode!=46 ||/.dd$/.test(value))event .returnValue=false">

8. There can only be up to two digits after the decimal point (numbers, letters, and Chinese can be entered), and operation symbols can be entered:
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