梦之都
JavaScript教程
isNaN
函数,检测值是否为非数字
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>JavaScript isNaN() 函数示例</title> </head> <body> <script type="text/javascript"> document.write(isNaN(0)); document.write("<br />"); document.write(isNaN(0/0)); document.write("<br />"); document.write(isNaN("8")); document.write("<br />"); document.write(isNaN("hello")); document.write("<br />"); document.write(isNaN(false)); document.write("<br />"); document.write(isNaN(parseInt("3"))); document.write("<br />"); document.write(isNaN(parseInt("hello"))); document.write("<br />"); document.write(isNaN(undefined)); </script> </body> </html>