Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Tuesday 14 February 2012

Create a Form in HTML with two fields, minimum and maximum, write JavaScript to validate that only numeric value is entered in both, and the value entered in minimum is less than the value entered in maximum.

<html>
<head>
<script language="javascript">
function check()
{

minno=f1.min.value;
maxno=f1.max.value;
if ( isNaN(minno) || isNaN(maxno))
{
alert("Number should be numeric in nature");
f1.min.value="";
f1.max.value="";
}
else
if (minno < maxno)
alert("CONGRATULATION YOU KNOW MATHEMATICS");
else
alert("GOTO TO FIRST CLASS TO LEARN MATHEMATICS");
}
</script>
</head>
<body>
<form name=f1>
<h3>PROGRAM 3 : </h3><h4>Numeric validation</h4>
<TABLE>
<TR><TH>Minimum Number : 
<TD><input type="text" name="min"><BR>
<TR><TH>Maximum Number :
<TD><input type="text" name="max"><BR>
<TR><TD><input type="button" name="b1" value="CLICK ME" onClick="check()">
</TABLE>
</form>
</body>
</html>

No comments:

Post a Comment