the cs101 assignment code is given below please make a folder cs101 then open notepad and save the code and save as it in to cs101 folder with the extention of .html
HTML Code:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript" language="javascript">
function check(numstr)
{
var a=document.getElementById('fid').value;
var regex1=/^[0-9-.]*$/;
if(document.theform.grd.value.length<1)
{
document.theform.grd.style.backgroundColor="pink";
alert("Please enter CGPA!");
}
else if(regex1.test(a)==false)
{
document.theform.grd.style.backgroundColor="red";
alert("Please enter numeric value only");
fid.focus();
}
else if(document.theform.grd.value>4 || document.theform.grd.value<1)
{
document.theform.grd.style.backgroundColor="lightskyblue";
alert("Numeric Value Must be Between 0 and 4");
}
else if(document.theform.grd.value>=1 && document.theform.grd.value<2)
{
document.theform.grd.style.backgroundColor="lime";
alert("Fair :: You got D grade");
}
else if(document.theform.grd.value>=2 && document.theform.grd.value<3)
{
document.theform.grd.style.backgroundColor="lime";
alert("Good :: You got C grade");
}
else if(document.theform.grd.value>=3 && document.theform.grd.value<4)
{
document.theform.grd.style.backgroundColor="lime";
alert("Very Good :: You got B grade");
}
else if(document.theform.grd.value=4)
{
document.theform.grd.style.backgroundColor="lime";
alert("Excellent :: You got A grade ");
}
}
</script>
</head>
<body bgcolor="#666666">
<h1 align="center">Your VU-ID Here:: Assignment (CS101)</h1>
<form name="theform">
<table border="1px" align="center" cellpadding="10px" cellspacing="1px">
<tr>
<td width="46">
CGPA </td>
<td width="199">
<input type="text" width="20px" name="grd" id="fid" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="button" value="Find Grade" onclick="check()"/>
</td>
</tr>
</table>
</form>
</body>
</html>