日期:2014-05-16  浏览次数:20394 次

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