手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >javascript中全局对象的isNaN()方法使用介绍
javascript中全局对象的isNaN()方法使用介绍
摘要:复制代码代码如下:全局对象的isNaN()方法/*isNaN()函数通常用于检测parseFloat()和parseInt()的结果,以判断...

复制代码 代码如下:

<html>

<head>

<title>全局对象的isNaN()方法</title>

<script>

/*

isNaN() 函数通常用于检测 parseFloat() 和 parseInt() 的结果,以判断它们表示的是否是合法的数字。

当然也可以用 isNaN() 函数来检测算数错误,比如用 0 作除数的情况。

*/

document.write(isNaN(123) + "<br/>");//false

document.write(isNaN(-1.23) + "<br/>");//false

document.write(isNaN(5-2) + "<br/>");//false

document.write(isNaN(0) + "<br/>");//false

document.write(isNaN("Hello") + "<br/>");//true

document.write(isNaN("2005/12/12")+ "<br/>");//true

</script>

</head>

<body>

<div id="time"></div>

</body>

</html>

【javascript中全局对象的isNaN()方法使用介绍】相关文章:

JavaScript中String.match()方法的使用详解

使用JavaScript刷新网页的方法

JavaScript中的unshift()方法的使用

详解JavaScript中void语句的使用

javascript基于DOM实现省市级联下拉框的方法

document对象execCommand的command参数介绍

JavaScript中的sub()方法的使用介绍

JavaScript获得指定对象大小的方法

JavaScript中操作字符串小结

Javascript实现每日自动换一张图片的方法

精品推荐
分类导航