<!doctype html> <html> <head> <meta charset="utf-8"> <title>判断一个数字是整数还是小数</title> </head> <body> <div id="box"></div> <script type="text/javascript"> var number=123.456 if(parseInt(number)==number){ alert('是整数'); }else{ alert('不是整数'); } </script> </body> </html>