当前位置: 代码迷 >> JavaScript >> object doesn't support this method or property,该如何解决
  详细解决方案

object doesn't support this method or property,该如何解决

热度:875   发布时间:2012-02-08 19:52:21.0
object doesn't support this method or property
HTML的一个页面,在localhost环境下。

SetMenu是在body   onLoad时触发。

function   SetMenu(){    
    var   wnt=new   ActiveXObject( "WScript.Network ");      
    //alert( "The   computer   name   is "+wnt.ComputerName+ ",User   name   is "+wnt.UserName+ ",DOMAIN   is   "+wnt.UserDomain);  
    document.getElementByID( "username ").value=wnt.UserName
}

这个alert是可以出来的,但是下面这句document.getElementByID( "username ").value=wnt.UserName则不行,会提示:
object   doesn 't   support   this   method   or   property

请问这是什么问题,如何解决?


------解决方案--------------------
document.getElementByID这个错了,应该是document.getElementById
  相关解决方案