JS verification of mobile phone number, mailbox, number, file suffix __javascript

Source: Internet
Author: User
JS Verification File/** * Verify mobile number format * @param {Object} ID/function Checkmobile (ID) {var val = $ ("#" + ID). val ();    
    var reg =/^1[3|4|5|8][0-9]\d{8}$/; if (!) (
        Reg.test (val))) {$ ("#" + ID). val ("");
        $ ("#" + ID). focus ();
    return false;
return true;
    /** * Verify number * @param {Object} ID/function Checknum (ID) {var val = $ ("#" + ID). val ();
    var reg =/^\d+$/; if (!) (
        Reg.test (val))) {$ ("#" + ID). val ("");
        $ ("#" + ID). focus ();
    return false;
return true;
    /** * Verify Mailbox * @param {Object} ID/function Checkemail (ID) {var val = $ ("#" + ID). val (); var reg=/^ (\w-*\.*) +@ (\w-?) 
    + (\.\w{2,}) +$/; if (!) (
        Reg.test (val))) {$ ("#" + ID). val ("");
        $ ("#" + ID). focus ();
    return false;    
return true;
    /** * Check content is not empty * @param {Object} ID/function Checknull (ID) {var val = $ ("#" + ID). val (). Trim (); if (val = = Undefined | | val = = "") {$ ("#" + ID). val ("");
        $ ("#" + ID). focus ();
    return false;
return true;
    /** * Check URL format is correct * @param {Object} ID/function Checkwebsite (ID) {var val = $ ("#" + ID). val (); var reg=/[a-za-z0-9][-a-za-z0-9]{0,62} (\.[ A-ZA-Z0-9][-A-ZA-Z0-9]{0,62}) +\.?
    /;; if (!) ( Reg.test (val)) {alert ("URL format is not correct.)
        ");
        $ ("#" + ID). val ("");
        $ ("#" + ID). focus ();
    return false;    
return true;

 }

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.