Skip to main content

If else Condition Scholarship

<!DOCTYPE html>

<html>

<head>

<body>

<h1>Determine Scholarship </h1>

<p>Enter your details : </p>

<fieldset>

<label>Enter your name </label>

<input type="text" onfocus="this.value=''" name="fname" id="fname" value="" /> <br> <!-- create input text box for name -->

<label>Enter your average grade </label>

<input type="number" onfocus="this.value=''" name="grade" id="grade" value="" /> <br> <!-- create input text box

for grade -->

<button onclick="display()" name="Display" id="display" value="Display" > Display </button> <!--button will call display

function in javascript -->

</fieldset>

<p id="demo"></p> <!--paragraph where name and grade will display -->

<p id="demo2"></p> <!--paragraph where remarks will display -->

<script>

function display()

{

fname=document.getElementById("fname").value; //get the input name in the textbox fname

grade=document.getElementById("grade").value; //get the input grade in the textbox age

document.getElementById("demo").innerHTML = "Name " + fname + "<br> Grade :" +grade; // display name and grade in the paragraph demo...

if(grade>=99)

remarks = "<font color=blue> <u><emp> Congratulations you are qualifed for 100% Scholarship" ;

else

remarks = " <font color=red> <i> Sorry you are not qualified for Scholarship" ;

document.getElementById("demo2").innerHTML = "<br> Remarks :" +remarks; //display the remarks in another paragraph demo2

}

</script>

</body>

</html>

Comments