Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title>JavaScript if  else statement :  Example-1</title>
</head>
<body>
<h1 style="color: red">JavaScript : if else statement</h1>
<h3> Here the if  else statement check whether the input marks is greater than 50 or not.</h3>
<hr />
<form name="form1" action ="#">
Input the marks<input type="text" name="text1" value=" " />
<input type="button" value="Marks check"
onclick='marksgrade()' />
</form>
<script src="if-else-example1.js"></script>
</body>
</html>
 
function marksgrade()
{
if (document.form1.text1.value>50)
alert('Marks is greater than 50.');
else
alert('Marks is less than or equal to 50.');
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x