viewing paste Unknown #52987 | Javascript

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
<HTML>
<HEAD>
<TITLE> Information Input </TITLE>
<script type="text/javascript">
function validate()
{
var a=document.getElementById("NameOfHail").value   
var b=document.getElementById("Yearofconstruction").value
var c=document.getElementById("Type").value
var d=document.getElementById("color").value
var e=document.getElementById("Specials").value
count1=0
count2=0
count3=0
if (a.length<9)
{
     alert("The Name of Hail must be more than 9 characters")
     return false;
    }
for ( i=0;i<a.length; i++)
{
    if((a.charAt(i)>="a" && a.charAt(i)<="z")||(a.charAt(i)>="A" && a.charAt(i)<="Z"))    
        count1++;
}
    if (count1!= a.length)
    {
        alert("not letter");
         return false;
    }
 
if (b.length!=4)
{
alert("The Yearofconstruction must be 4 characters")
return false;
}
if(isNaN(b))
{
 alert("The Yearofconstruction must contain only digits");
return false;
}
if (c.length<5)
{
     alert("The Type must be more than 5 characters")
     return false;
    }
for ( i=0;i<c.length; i++)
{
    if((c.charAt(i)>="a" && c.charAt(i)<="z")||(c.charAt(i)>="A" && c.charAt(i)<="Z"))    
        count2++;
}
    if (count2 != c.length)
    {
        alert("not letter");
         return false;
    }
 
if (d.length<=3)
{
     alert("The name must be more than 3 characters ")
     return false;
    }
if(d.length>=10)
{
     alert("The name must be less than 10 characters ")
     return false;
    }
 
for ( i=0;i<d.length; i++)
{
    if((d.charAt(i)>="a" && d.charAt(i)<="z")||(d.charAt(i)>="A" && d.charAt(i)<="Z"))    
        count3++;
}
    if (count3 != d.length)
    {
        alert("not letter");
         return false;
    }
 
if (e.length<15)
{
     alert("The name must be more than 15 characters")
     return false;
    }
 return true;
}
</script>
</HEAD>
 
<BODY style="background-color:#8FB59E;color:#476B8F">
<FORM METHOD=POST ACTION="add1.jsp"onsubmit="return validate()">
<CENTER><TABLE>
<TR>
    <TD>NameOfHail</TD>
    <TD><INPUT TYPE="text" NAME="NameOfHail"></TD>
</TR>
<TR>
    <TD>Yearofconstruction</TD>
    <TD><INPUT TYPE="text" NAME="Yearofconstruction"></TD>
</TR>
<TR>
    <TD>Type</TD>
    <TD><INPUT TYPE="text" NAME="type"></TD>
</TR>
<TR>
    <TD>color</TD>
    <TD><INPUT TYPE="text" NAME="color"></TD>
</TR>
<TR>
    <TD>Specials</TD>
    <TD><INPUT TYPE="text" NAME="Specials"></TD>
</TR>
<TR>
    <TD><INPUT TYPE="submit"></TD>
    <TD><INPUT TYPE="reset"></TD>
</TR>
 
 
</TABLE></CENTER>
</FORM>
 
</BODY>
</HTML>
Viewed 607 times, submitted by Guest.