Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Use regular expression full-width half-width restriction when entering input

Shulou Source: shulou.com Published: 2022-06-03 06:09:47 09月24日 Update

Member ID

Third, only integers are allowed. In fact, it is entirely possible to impose some restrictions in accordance with Article 3.

Function onlyNum ()

{

If (! (event.keyCode==46) & &! (event.keyCode==8) & &! (event.keyCode==37) & &! (event.keyCode==39))

If (! (event.keyCode > = 48&&event.keyCode=96&&event.keyCode)

Only English letters, numbers and underscores are allowed (implemented by the following two methods)

Third, only integers are allowed. In fact, it is entirely possible to impose some restrictions in accordance with Article 3.

Function onlyNum ()

{

If (! (event.keyCode==46) & &! (event.keyCode==8) & &! (event.keyCode==37) & &! (event.keyCode==39))

If (! (event.keyCode > = 48&&event.keyCode=96&&event.keyCode)

Only English letters, numbers and underscores are allowed (implemented by the following two methods)

Only Chinese characters are allowed to be input

Only Chinese characters are allowed to be input

Tags: Input numbers full-width letters Chinese English half-width restrictions characters integers Korean Chinese characters regular expressions practical examples tears underline bad number of pieces Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei MariaDB MySQL Docker