Home >Web Front-end >JS Tutorial >Example of Javascript prohibiting input of Chinese or English_javascript skills

Example of Javascript prohibiting input of Chinese or English_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:28:042052browse

This tutorial teaches you how to use Javascript to limit the input of English or limit the input of Chinese.

English input is prohibited:

Copy code The code is as follows:


Use regular expressions to limit input to Chinese only:

Copy code The code is as follows:


1. Use regular expressions to limit the input of only full-width characters:

Copy code The code is as follows:


2. Use regular expressions to limit input to numbers:

Copy code The code is as follows:


3. Use regular expressions to limit input to numbers and English only:

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