August 1999
Intermediate to advanced
1488 pages
72h 53m
English
math.min(num1, num2)
The min() method of the Math object gets the minimum number of the two number parameters passed to it. The smaller value is returned as the result.
Listing 6.167 shows how to use the Math.min() method.
<html> <body> <script language="JavaScript"> <!–– Hide // function returns the minimum of two arguments function doMath(){ var inputNum1=document.form1.input1.value; var inputNum2=document.form1.input2.value; var result = Math.min(inputNum1, inputNum2); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> This example takes the two ... |
Read now
Unlock full access