Home >Web Front-end >JS Tutorial >JavaScript implements input input box related restrictions usage_form special effects

JavaScript implements input input box related restrictions usage_form special effects

WBOY
WBOYOriginal
2016-05-16 19:11:501013browse

1. Cancel the dotted box when the button is pressed
Add the attribute value hideFocus or HideFocus=true to the input

2. Read-only text box content
Add the attribute value readonly to the input

3. Prevent the TEXT document that is cleared after going back (the style content can be used as a class reference)
 




4. The ENTER key can Move the cursor to the next input box
 

5. Can only be in Chinese (with flashing)
 

6. Can only be in numbers (with flashing) Flashing)
 

7. Can only be numbers (no flashing)
 57)) event.returnValue=false">

8. Only English and numbers can be entered (with flashing)
 

9. Shield input method
 

10. Only numbers, decimal points, and minus can be entered (-) character (no flashing)
 57)) event.returnValue=false">

11. Only two decimal places can be entered, three decimal places (with flashing)
 57) && event.keyCode!=46 && event.keyCode!=45 || value.match(/^d{3}$/) || /.d{3}$/.test(value )) {event.returnValue=false}" id=text_kfxe name=text_kfxe>


------------------------ ---------------------------------------------


How to make the content in the input read-only, which means that users are not allowed to change the content inside.


<.>It is best not to use disabled, otherwise you will not be able to get the value inside.


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