HTML input text box advanced application

Source: Internet
Author: User
Tags html input text

Accidentally hit, maybe it will be used later. 1. When the cancel button is pressed, add the value hideFocus or HideFocus = true in the input field. 2. Add the value readonly to the content of the read-only TEXT box in the input field. 3. Remove the TEXT file (you can reference the style content as a class) <input style = "behavior: url (# default # savehistory ); "type =" text "id =" oPersistInput "> 4. Press ENTER to move the cursor to the next input box <input onkeydown =" if (event. keyCode = 13) event. keyCode = 9 "> 5. It can only be Chinese (with flashing) <input onkeyup =" value = value. replace (/[-~] /G, '')" onkeydown = "if (event. keyCode = 13) event. keyCode = 9 "> 6. It can only be numbers (with flashing) <input onkeyup =" value = value. replace (/[^ \ d]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[^ \ d]/g, '')"> 7. It can only be a number (no flashing) <input style = "ime-mode: disabled "onkeydown =" if (event. keyCode = 13) event. keyCode = 9 "onKeyPress =" if (event. keyCode <48 | event. keyCode> 57) event. returnValue = false "> 8. Only English letters and numbers can be entered. (With flashing) <input onkeyup = "value = value. replace (/[\ W]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[^ \ d]/g, '')"> 9. Blocked input Method <input type = "text" name = "url" style = "ime-mode: disabled "onkeydown =" if (event. keyCode = 13) event. keyCode = 9 "> 10. You can only enter numbers, decimal points, minus signs (-), and characters (no flashing) <input onKeyPress =" if (event. keyCode! = 46 & event. keyCode! = 45 & (event. keyCode <48 | event. keyCode> 57) event. returnValue = false "> 11. Only two integers and three decimal places (with flashing) can be input. <input maxlength =" 9 "onkeyup =" if (value. match (/^ \ d {3} $/) value = value. replace (value, parseInt (value/10); value = value. replace (/\. \ d *\. /g ,'. ') "onKeyPress =" if (event. keyCode <48 | event. keyCode> 57) & event. keyCode! = 46 & event. keyCode! = 45 | value. match (/^ \ d {3 }$/) | /\. \ d {3} $ /. test (value) {event. returnValue = false} "id =" text_kfxe "name =" text_kfxe ">

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.