+ Reply to Thread
Results 1 to 4 of 4

Thread: javascript validation

  1. #1

    Default javascript validation

    <script type="text/javascript">
    function setMessage(message)
    {
    mdiv = document.getElementById("userIdMessage");
    if (message == "invalid")
    { mdiv.innerHTML =
    "<div style=\"color:red\">Invalid User Id</ div>";
    }
    else
    { mdiv.innerHTML =
    "<div style=\"color:green\">Valid User Id</ div>";
    }
    }
    </script>

    <body>
    <div id="userIdMessage"></div>
    </body>

  2. #2

    Default

    JavaScript can be used to validate data in HTML forms before sending the content to a server

  3. #3

    Default

    Hi..i provides easily understandable alphabet text field validation scripts here...
    <html>
    <head>
    <script type='text/javascript'>
    function isAlphabet(elem, helperMsg){
    var alphaExp = /^[a-zA-Z]+$/;
    if(elem.value.match(alphaExp)){
    return true;
    }else{
    alert(helperMsg);
    elem.focus();
    return false;
    }
    }
    </script>
    </head>
    <body>
    <form>
    Letters Only: <input type='text' id='letters'/>
    <input type='button'
    onclick="isAlphabet(document.getElementById('lette rs'), 'Letters Only Please')"
    value='Check Field' />
    </form>
    </body>
    </html>


    Cegonsoft

  4. #4
    Sapphire Star member anusha is on a distinguished road
    Join Date
    Sep 2011
    Posts
    56

    Default

    JavaScript is used to validate the data in HTML forms before sending the content to the server..
    Examples of thejava script:
    Games
    Quake II GWT Port
    Akihabara CapMan

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts