JavaScript Tutorial/Global/Infinity
Global.Infinity
Infinity is a JavaScript keyword that represents positive infinity.
<html>
<body>
<script language = "JavaScript">
<!--
function checkNum(){
input=document.form1.num.value;
if(input < Infinity){
alert("Your number is less than Infinity");
}
else if(input > Infinity){
alert("Your number is greater than Infinity");
}else if(input == Infinity){
alert("Your number if equal to Infinity");
}else{
alert("do not know how to compare");
}
}
-->
</script>
<form name="form1">
Enter a number to compare against Infinity.
<br><br>
<input type="text" size="35" name="num">
<br><br>
<input type="button" value="Check Number" onClick="checkNum()">
</form>
</script>
</body>
</html>