jQuery.isNumeric()方法
jQuery 教程
· 2019-03-28 21:56:35
实例
判断输入值类型
$(function () {
function fun( html ){
document.body.innerHTML += "<br>" + html;
}
// true
fun($.isNumeric( "-10" ));
fun($.isNumeric( "0" ));
fun($.isNumeric( 0xFF ));
fun($.isNumeric( "0xFF" ));
fun($.isNumeric( "8e5" ));
fun($.isNumeric( "3.1415" ));
fun($.isNumeric( +10 ));
fun($.isNumeric( 0144 ));
//false
fun($.isNumeric( "-0x42" ));
fun($.isNumeric( "7.2acdgs" ));
fun($.isNumeric( "" ));
fun($.isNumeric( {} ));
fun($.isNumeric( NaN ));
fun($.isNumeric( null ));
fun($.isNumeric( true ));
fun($.isNumeric( Infinity ));
fun($.isNumeric( undefined ));
})
定义和用法
$.isNumeric() 函数用于判断指定参数是否是一个数字值。
注意:在jQuery 3.0中,$.isNumeric()方法只有接收number类型的参数,或者是可以被强制为有限数值的 string类型的参数时,才会返回true,否则返回false。
语法
$.isNumeric( value )
| 参数 | 描述 |
|---|---|
| value | 任意类型 需要进行判断的任意值。 |
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
C++语言的设计和演化
[美] Bjarne Stroustrup / 裘宗燕 / 机械工业出版社 / 2002-1 / 48.00元
这本书是C++的设计者关于C++语言的最主要著作之一。作者综合性地论述了C++的历史和发展,C++中各种重要机制的本质意义和设计背景,这些机制的基本用途和使用方法,讨论了C++所适合的应用领域及其未来的发展前景。一起来看看 《C++语言的设计和演化》 这本书的介绍吧!