JavaScript parseint ()
Js parseint () function
During work, set the MTU value in the gateway and see this function. Usage:
Function saveMtu ()
{
Var maxMtu;
With (document. forms [0])
{
MaxMtu = parseInt (mtu. value );
If (isNaN (mtu. value ))
{
Alert (MTU value! + Mtu. value + invalid, value range (68--1500 )!);
Return 0;
}
If (maxMtu <68 || maxMtu> 1500)
{
Alert (MTU value! + Mtu. value + invalid, value range (68--1500 )!);
Return 0;
}
Loc + = & maxMtu = + maxMtu;
}
Return 1;
}
View W3C. It is interpreted as: A string can be parsed and an integer is returned.
parseInt(string, radix)
String is a required string to be parsed.
Radix is optional. The base number of the resolution. Similar to, the base number is parsed in decimal and hexadecimal notation. If this parameter is smaller than 2 or greater than 36, parseInt () returns NaN.
ParseInt (10); // returns 10 parseInt (19,10); // returns 19 (10 + 9) (decimal) parseInt (11,2); // returns 3 (2 + 1) (in hexadecimal notation, the left 1 is 2, and the right 1 is 1, so it is 2 + 1) parseInt (17,8); // returns 15 (8 + 7) (octal, 17 is equal to 8 for the left 1 and 7 for the right, so 8 + 7)
ParseInt (2f, 16); // return 47 (hexadecimal, 2*16 + 15 = 47) parseInt (010); // Undetermined: return 10 or 8
For example:
Print:
10
29
7
23
47
10
NaN