您现在的位置是:首页 > 电脑技术查询 > web开发

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

编辑:chaxungu时间:2022-10-02 23:18:55分类:web开发

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