how to check three grater number in JavaScript
JavaScript conditional Statements
<!doctype html>
<html>
<head>
<title> js Conditional Statements </title>
</head>
<body>
<script>
function checkValue(){
var a = document.getElementById("value1").value;
var b = document.getElementById("value2").value;
var c = document.getElementById("value3").value;
if(a>b && a>c){
document.getElementById("check").innerHTML = "1st is grater";
}
else if(b>a && b>c){
document.getElementById("check").innerHTML = "2nd is grater";
}
else{
document.getElementById("check").innerHTML = "3nd is grater";
}
}
</script>
<h2 id="check"> </h2>
<input type="text" id="value1" placeholder="Enter first value" />
<br />
<input type="text" id="value2" placeholder="Enter second value" />
<br>
<input type="text" id="value3" placeholder="Enter third value" />
<hr />
<button type="button" onclick="checkValue()"> Find </button>
</body>
</html>
Post A Comment
No comments :
Thanks For visiting Infotech Solutuion Blog