View Single Post
  #7 (permalink)  
Old January 9th, 2008, 05:25 AM
jijish jijish is offline
Authorized User
 
Join Date: Nov 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You failed to close the </script> tag. This is the improvised code.

<html>
<head>
<title></title>

<script language="javascript">
function Validate()
{
        var x = document.sform.phone_no.value;
        if(isNaN(x)|| x.indexOf(" ")!=-1){
              alert("Enter numeric value");return false; }
        if (x.length > 10 || x.length > 8 ){
                alert("enter 10 or 8 characters"); return false;
           }
        if (x.charAt(0)!="9" || x.charAt(0)!="2"){
                alert("it should start with 9 or 2 ");
                return false
           }
}

</script>
</head>
<body>
<table width="290" height="83" border="0" bgcolor="#F4FAFF">
    <form name="sform" action="search_phone.jsp" method="post">
      <tr class="smallfont">
        <td width="247" height="24" align="center" valign="middle" class="table_header">New Appointment </td>
        <td align="left" valign="middle">&nbsp;</td>
      </tr>

      <tr class="smallfont">
        <td height="26" align="left" valign="middle"><span class="style4">Phone Number
          <input name="phone_no" type="text" id="phone_no" />
        </span></td>
        <td width="33" align="left" valign="middle"><input type="submit" name="Submit" value="Go" onclick="return Validate()"/></td>
      </tr>
      <tr class="smallfont">
        <td height="25" align="left" valign="middle">&nbsp;</td>
        <td align="left" valign="middle">&nbsp;</td>
      </tr>
    </form>
  </table>
</body>
</html>


Reply With Quote