Infolinks In Text Ads

Jul 24, 2010

Mobile No Validation javascript

How to validate mobile no in java script.

<HTML>
<head>
    <script>
    function ToCellValidate(objText)
    {
        if(objText.value!="")
        {
        if(objText.value.length < 9 || objText.value.length > 15 || objText.value.search(/[^0-9\-()+]/g) != -1 )
        {
        alert('Please enter valid mobile number');
        objText.focus();
        objText.value.value="";
        return false;
        }
        else{
        alert("valid mobile number");
        return true;
        }
        }
    }
    </script>
</head>
 <BODY>
  <input type="text" name="text" id="text"><br/><input type="submit" name="validate" value="validate" onclick=ToCellValidate(document.getElementById('text'));>
 </BODY>
</HTML>

1 comment:

  1. Give javascript code for telephone validation and income validation

    ReplyDelete

LinkWithin

Related Posts Plugin for WordPress, Blogger...