parseInt()返回从字符串转换而来的整数,是一个函数
Number返回或设置与特定错误相联系的数字值,是一个属性

解决方案 »

  1.   

    aa=parseInt('123')
    aa = 123
    Number最典型的应用是在错误处理上:
    try
     { x = y // 产生错误。}
    catch(var e){ // 创建局部变量 e。
      document.write(e)                     // 打印 "[object Error]"。
      document.write(e.number>>16 & 0x1FFF) // 打印 10,设施代码。
      document.write(e.number & 0xFFFF)     // 打印 5009,错误代码。
      document.write(e.description)
      

  2.   

    parseInt
    Parses a string argument and returns an integer of the specified radix or base.
    核心函数  
    实现版本 Navigator 2.0: If the first character of the string specified in parseInt(string) cannot be converted to a number, returns "NaN" on Solaris and Irix and 0 on all other platforms.Navigator 3.0, LiveWire 2.0: Returns "NaN" on all platforms if the first character of the string specified in parseInt(string) cannot be converted to a number.  语法
    parseInt(string,radix) 
    参数
    string A string that represents the value you want to parse. 
    radix (Optional) An integer that represents the radix of the return value. 描述
    The parseInt function is a built-in JavaScript function.
    The parseInt function parses its first argument, a string, and attempts to return an integer of the specified radix (base). For example, a radix of 10 indicates to convert to a decimal number, 8 octal, 16 hexadecimal, and so on. For radixes above 10, the letters of the alphabet indicate numerals greater than 9. For example, for hexadecimal numbers (base 16), A through F are used.If parseInt encounters a character that is not a numeral in the specified radix, it ignores it and all succeeding characters and returns the integer value parsed up to that point. parseInt truncates numbers to integer values.If the radix is not specified or is specified as 0, JavaScript assumes the following:If the input string begins with "0x", the radix is 16 (hexadecimal). If the input string begins with "0", the radix is eight (octal). If the input string begins with any other value, the radix is 10 (decimal). 
    If the first character cannot be converted to a number, parseInt returns "NaN".
    For arithmetic purposes, the "NaN" value is not a number in any radix. You can call the isNaN function to determine if the result of parseInt is "NaN". If "NaN" is passed on to arithmetic operations, the operation results will also be "NaN".
    示例
    The following示例 all return 15:
    parseInt("F", 16)
    parseInt("17", 8)
    parseInt("15", 10)
    parseInt(15.99, 10)
    parseInt("FXX123", 16)
    parseInt("1111", 2)
    parseInt("15*3", 10) The following示例 all return "NaN":parseInt("Hello", 8)
    parseInt("0x7", 10)
    parseInt("FFF", 10) Even though the radix is specified differently, the following示例 all return 17 because the input string begins with "0x".parseInt("0x11", 16)
    parseInt("0x11", 0)
    parseInt("0x11") 
    -----------------------------------------------
    -----------------------------------------------
    将指定对象转换为数字。 
    核心函数   
    实现版本  Navigator 4.0, Netscape Server 3.0 语法
    Number(obj) 
    参数
    obj  一个对象。 描述
    如果对象是 Date 类型的对象,Number 将返回自格林威治标准时间 1970 年 1 月 1 日起已经经过的毫秒数,在此日期之后的是正数,之前的是负数。 
    如果 obj 是一个没有数字格式的字符串,Number 将返回 NaN。 
    示例
    下面的例子将把 Date 对象转换为数值型值: 
    <SCRIPT>
    d = new Date ("December 17, 1995 03:24:00"); 
    document.write (Number(d) + "<BR>");
    </SCRIPT> 屏幕上将显示 "819199440000." 
      

  3.   

    首先,概念上Number是一个对象Number()是这个对象的构造方法。
    parseInt是一个方法,能直接写parseInt是因为它是window对象的一个方法,window可以省略。其次,用法上Number()只有一个参数,可以是一个字符串,也可以是其他对象(如楼上),这个要看脚本解释器(IE?)对于这个参数的处理方法。
    window.parseInt()有两个参数,后一个可选,前一个是字符串,后一个是进制的位权(?是叫这个吧)
    其实Number的用法应该是new Number("2");
      

  4.   

    其实对于parseInt,IE中的脚本是可以写window.parseInt("3")这样的。但是对于脚本宿主就没有window对象了,取代window的是什么呢,WScript对象是没有的,难道parseInt在脚本宿主里是做一个函数处理的?
      

  5.   

    parseInt ( cString )从字符串cString非空字符开始转换得到的整数,遇到小数点或其他0-9外的字符就停止,如“-1234a”,“-1234.0”都将返回-1234;如果除第一个符号外一个0-9字符都不是,将返回NaN,如“-a”、“abc”等;
    Number( cString )从字符串cString转换得到的数字,包括Int和Float类型,如:“-123”返回-123,“123”和“00123”都返回123,“234。56”返回234。56等。cString必须是合法的数字串,否则返回NaN;如“.123”、“1.23.45”、“--123”、“123a"都返回NaN.
    总之Number( )更象parseFloat( ),Number对参数更挑剔,稍有不是数字就返回NaN。parseFloat支持第一个非空字符为小数点,如parseFloat(".123" )返回0.123。而Number(".123" )返回NaN。空字符串或完全空格串健壮的parseFloat()返回NaN,而Number()返回0,这有点让人费解。除了不支持无前导0小数(如.123、-.123)和支持多余的前导0(如-00123返回-123)多少不符合常规外,Number能用来验证数字串!
      

  6.   

    代表数值数据类型和提供数值常数的对象。numObj = new Number(value)
    参数
    numobj 
    必选项。要赋值为 Number 对象的变量名。 
    value 
    必选项。正在创建的 Number 对象的数值。 
    说明
    JScript 根据数字值的要求创建 Number 对象。很少有必要显式创建 Number 对象。Number 对象最主要的用途是将其属性集中到一个对象中,以及使数字能够通过 toString 方法转换为字符串。
    parseInt 方法
    请参阅
    isNaN 方法 | parseFloat 方法 | String 对象 | valueOf 方法应用于: Global 对象
    要求
    版本 1
    返回由字符串转换得到的整数。parseInt(numString, [radix])
    参数
    numString 
    必选项。要转换为数字的字符串。 
    radix 
    可选项。在 2 和 36 之间的表示 numString 所保存数字的进制的值。如果没有提供,则前缀为 '0x' 的字符串被当作十六进制,前缀为 '0' 的字符串被当作八进制。所有其它字符串都被当作是十进制的。 
    说明
    parseInt 方法返回与保存在 numString 中的数字值相等的整数。如果 numString 的前缀不能解释为整数,则返回 NaN(而不是数字)。parseInt("abc")     // 返回 NaN。
    parseInt("12abc")   // 返回 12。
    可以用 isNaN 方法检测 NaN。