August 1999
Intermediate to advanced
1488 pages
72h 53m
English
Infinity
Infinity is a JavaScript keyword that represents positive infinity.
Listing 6.146 shows how the Infinity keyword is used. An input text box is provided to enter a value to be compared to Infinity. If any number is entered, it will result in being less than Infinity. However, if the word "Infinity" is entered, it will result in being equal to Infinity.
<html> <body> <script language = "JavaScript"> <!–– Hide // function checks to see if the input is greater, less than, or equal // to the value input by the user. function checkNum(){ input=document.form1.num.value; if(input < Infinity){ alert("Your ... |
Read now
Unlock full access