typeof只能返回object,number,string,boolean,undefined

解决方案 »

  1.   

    你alert(document.getElementById("hel"));看会弹出什么``
      

  2.   


    是对象,数组和null 的时候 typeof(x) 返回的是 "object" 
    typeof(x)返回的字符串可能有:"number"、"string"、"boolean"、"object"、"function" 和 "undefined" 
      

  3.   

    typeof返回的是括号中东西的类型,就是说对象类型,而不是属于button还是text
      

  4.   

    document.getElementByID(object)返回是一个对象类型所以alert之后就是object了
      

  5.   

    学习了~
    再记一次,typeof只返回object,number,string,boolean.undefined
      

  6.   

    注意。typeof返回的是变量类型
    在JS中,HTML元素的类型均为对象(object)
    如果你要判断元素类型,可以使用document.getDocumentById(...).tagName
      

  7.   

    要得到button 可以用document.getDocumentById(id).type
      

  8.   

    document.getElementbyId()返回的是ELement类型 是NODE的子类
    当然是obj类型
      

  9.   

    typeof返回的是对象类型,input的type指定的不是对象类型,这个type只是一个属性。
    获取方式就是10楼的说法