ExtJS学习-----------Ext.Number,ExtJS对javascript中的Number的扩展
2015-05-07 19:33
99 查看
关于ExtJS对javascript中的Number的扩展,能够參考其帮助文档,文档下载地址:http://download.csdn.net/detail/z1137730824/7748893
以下对当中的部分方法进行介绍:
(1)constrain
constrain( Number number, Number min, Number max )
: Number
检查给定的数值是否在约束的范围内。 If the number is already within the 假设再范围内就返回此数值。否则,假设大于最大值则返回最大值,假设小于最小值则返回最小值。, otherwise the min or max value is returned depending on which side of the range is 注意本方法不改变给定的数值本身。 Note that this method returns the constrained value but does
not change the current number.
要检查的数值
min : Number
范围的最小值
max : Number
范围的最大值
The constrained value if outside the range, otherwise the current value
(2)randomInt,随机产生一个范围内的随机数
randomInt( Number from, Number to )
: Number
Returns a random integer between the specified range (inclusive)
Lowest value to return.
to : Number
Highst value to return.
(3)toFixed,四舍五入取得输入的数值的小数点后几位
toFixed( Number value, Number precision )
Formats a number using fixed-point notation
The number to format
precision : Number
The number of digits to show after the decimal point
以下对当中的部分方法进行介绍:
(1)constrain
constrain( Number number, Number min, Number max )
: Number
检查给定的数值是否在约束的范围内。 If the number is already within the 假设再范围内就返回此数值。否则,假设大于最大值则返回最大值,假设小于最小值则返回最小值。, otherwise the min or max value is returned depending on which side of the range is 注意本方法不改变给定的数值本身。 Note that this method returns the constrained value but does
not change the current number.
Parameters
number : Number要检查的数值
min : Number
范围的最小值
max : Number
范围的最大值
Returns
NumberThe constrained value if outside the range, otherwise the current value
(2)randomInt,随机产生一个范围内的随机数
randomInt( Number from, Number to )
: Number
Returns a random integer between the specified range (inclusive)
Parameters
from : NumberLowest value to return.
to : Number
Highst value to return.
(3)toFixed,四舍五入取得输入的数值的小数点后几位
toFixed( Number value, Number precision )
Formats a number using fixed-point notation
Parameters
value : NumberThe number to format
precision : Number
The number of digits to show after the decimal point
相关文章推荐
- ExtJS学习-----------Ext.String,ExtJS对javascript中的String的扩展
- ExtJS学习-----------Ext.Array,ExtJS对javascript中的Array的扩展
- ExtJS学习-----------Ext.Array,ExtJS对javascript中的Array的扩展(实例)
- ext4 学习笔记(七)[ExtJS扩展原生Javascript](白鹤翔第一季)
- Ext JS学习第十天 Ext基础之 扩展原生的javascript对象(二)
- Ext JS学习第九天 Ext基础之 扩展原生的javascript对象
- ExtJs--14--Ext.typeOf() 与 javascript中的typeof很相似,只是在类型上进行了一点简单的扩展,其实可以直接看源代码就可以看得懂的
- ExtJS学习------Ext.define的继承extend,用javascript实现相似Ext的继承
- ExtJS学习笔记 Ext.FormPanel
- extJs 2.1 学习笔记(Ext.data.HttpProxy篇)
- JavaScript学习笔记之DOM扩展
- 【ExtJs学习系列】Ext简介(一)
- extJs 2.1学习笔记(Ext.data.Store篇)
- javascript Number类型的扩展
- ES6学习——新的语法:数值字面量扩展(Number Literal Extensions)
- JavaScript中的Number数字类型学习笔记
- Atlas学习手记(27):JavaScript面向对象的扩展(一):命名空间Namespace
- ExtJS学习笔记(十二) Ext 获取组件、获取DOM
- ExtJs 学习笔记 Ext.Panle Ext.TabPanel Ext.Viewport第1/3页
- [原]Java程序员的JavaScript学习笔记(12——jQuery-扩展选择器)