ACT 4: Scholarship Discount using if Else
<!DOCTYPE html>
<html>
<title>Determine Discount</title>
<head>
<style>
p {
color: #35530A;
font-family: sans-serif;
font-size: 100%;
}
h1 {
color: #000000;
font-family:sans-serif;
font-size: 100%;
}
div {
position:inline;
border: 50px solid #000000
width: 100px;
background-color: #95E8A3
;
border-radius: 10px;
padding: 100px;
margin: 700px 700px;
}
body{background-color: #95E8A3
;}
</style>
</head>
<body>
<h1> Please fill up the form below: </h1>
<p style="font-family: "sans-serif;"> Enter name: </p> <input type="text" id="name" placeholder=" Enter name " /> <br> <br>
<p style="font-family: sans-serif;"> <b> Enter grade: </b> </p>
<p><input type="number" id="grade" placeholder=" Enter Grade " /><br><br>
<input type="button" id="getGrade" value=" Pass " onclick="getGrade()" />
<p id="demo"></p>
<script>
function getGrade() {
let name = document.getElementById("name").value;
let grade = document.getElementById("grade").value;
if (grade >= 98) {
document.getElementById("demo").innerHTML = " <b> Remarks : </b> Congratulations </b> " + name + " You Are Qualified For 100% Scholarship! ";
}
else {
document.getElementById("demo").innerHTML = " <b> Remarks : </b> Sorry " + name + " You're Not Qualified For 100% Scholarship. <b> Please try again next time! </b>";
}
}
</script>
</body>
</html>