<html>
<head>
<meta charset="utf-8">
<title>JavaScript form validation - checking phone number </title>
<script>
 function phonenumber(inputtxt)
{
  if(inputtxt.value.match(/^09\d{8}$/))
  {
      return true;
  }
  else
  {
    alert("Not a valid Phone Number");
     return false;
  }} </script>
</head>

<body>
<h2>Input an Phone No.[xxxxxxxxxx] and Submit</h2>
<form name="form1" action="#">
<ul>
<li><input type='text' name='text1'/></li>
<li> <input type="submit" name="submit" value="Submit" onclick="phonenumber(document.form1.text1)"/></li>
</ul>
</form>
</body>
</html>