I want to validate this form. in which first field obtained marks which should not be more than 1100 or less then 1 and in second field total marks should be 1100.. in third and fourth field will be same like previous two fields but with different ID and the last field marks should not be greater than 200 or less than 1.. and form should not proceed unless input is completely correct
function myFunction() {
var x, text, y, z;
// Get the value of the input field with id="numb"
x = document.getElementById("mfsc").value;
y = document.getElementById("matric").value;
z = document.getElementById("per").value;
// If x is Not a Number or less than one or greater than 10
if (isNaN(x) || x < 0 || x > 1100) {
alert("marks should be less then 1100");
}
if (isNaN(y) || y < 0 || y > 1100) {
alert("Matric Marks should be less then 1100");
}
if (isNaN(z) || z < 0 || z > 200) {
alert("NET Marks should not be more then 200");
}
}
<form action="merit-nust.php" method="Post" name="Form1" onsubmit="return validateForm()">
<div class="style1"> Enter Your marks in FSc</div>
<div align="left">
<input type="text" required style="width: 160px; float: left; margin-right: 1%;" size="20" placeholder="Obtained Marks in FSc Part-I" id="mfsc" class="TextBox form-control">
<input type="text" required class="TextBox form-control" placeholder="Total Marks in FSc Part-I" name="totalfsc" size="20" style="width: 160px; float: left; margin-right: 1%;">
</div>
<div align="left">
<input type="text" required style="width: 160px; float: left; margin-right: 1%;" size="20" placeholder="Obtained Marks in Matic" id="matric" name="matric" class="TextBox form-control">
<input type="text" required class="TextBox form-control" placeholder="Total Marks in Matric" name="totalmatric" size="20" style="width: 160px">
</div>
<div class="style1">NET Marks (out of 200)</div>
<label for="1">
<input type="text" required style="width: 160px" size="20" id="per" class="TextBox form-control">
<br>
</label>
<center>
<input type="submit" onClick="myFunction()" name="submit" value="Find Colleges" id="INPUT_27">
</center>
</form>