Input box verification, letters, Chinese characters, numbers, and other input boxes

Source: Internet
Author: User

Input box verification, letters, Chinese characters, numbers, and other input boxes

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Meta http-equiv = "X-UA-Compatible" content = "IE = edge">
<Title> regular form verification </title>
<Link rel = "stylesheet" href = "">
</Head>
<Body>
<P>
Only numbers are allowed.
<Input type = "text" onkeyup = "value = value. replace (/[^ \ d]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[^ \ d]/g, '')">
<Input type = "text" onkeyup = "this. value = this. value. replace (/[^ \ d]/g,'') ">
</P>

<P>
Only letters are allowed.
<Input type = "text" onkeyup = "value = value. replace (/[^ A-Za-z]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[^ A-Za-z]/g, '')">
<Input type = "text" onkeyup = "this. value = this. value. replace (/[^ a-zA-Z]/g,'') ">
</P>

<P>
Only Chinese characters are allowed.
<Input type = "text" onkeyup = "value = value. replace (/[^ \ u4e00-\ u9fa5]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[^ \ u4e00-\ u9fa5]/g, '')">
<Input type = "text" onkeyup = "this. value = this. value. replace (/[^ \ u4e00-\ u9fa5]/g,'') ">
</P>

<P>
Only numbers and letters can be entered.
<Input type = "text" onkeyup = "value = value. replace (/[\ W]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[\ W]/g, '')">
<Input type = "text" onKeyUp = "value = value. replace (/[\ W]/g,'') ">
</P>

<P>
Only data in the email format can be entered (letters, numbers -_@)
<Input type = "text" onkeyup = "value = value. replace (/[^ a-zA-Z \-_@\. 0-9]/g, '')" onbeforepaste = "clipboardData. setData ('text', clipboardData. getData ('text '). replace (/[^ a-zA-Z \-_@\. 0-9]/g, '')">
<Input type = "text" onKeyUp = "value = value. replace (/[^ a-zA-Z \-_@\. 0-9]/g, '')">
</P>
<P>
Only numbers, letters, and Chinese characters are allowed.
<Input type = "text" onkeyup = "value = value. replace (/[^ \ w \ u4E00-\ u9FA5]/g,'') ">

</Body>
</Html>

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.