我在global.asax.cs里面写了一段这样的函数是用到了js,其中那个enetgetMsg()来源于这个网站http://www.loneh.com/html/javascript/files/014.htm但是运行的时候老是报错不知道该怎么解决  protected void Application_BeginRequest(Object sender, EventArgs e)
{
Response .Write (@"<DIV id=""enetMeng""  style=""BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; 
LEFT: 0px; VISIBILITY: visible; BORDER-LEFT: #a6b4cf 1px solid; 1px solid; POSITION: absolute; TOP: -256px; HEIGHT: 157px""> </DIV>
 
<script  language=""javascript"" src=""JScript1.js""></script>
<script language=""javascript""> function GetMessage()
{
    var  objXmlHttp = new ActiveXObject(""Microsoft.XMLHTTP"");
    objXmlHttp.open(""post"",""webform3.aspx"",false);
        objXmlHttp.send();
        if (objXmlHttp.responseText != """")

document.getElementById(""enetMeng"").innerText = objXmlHttp.ResponseText
                     enetgetMsg()

}
  setTimeout(""GetMessage()"",5000)
}
GetMessage();
</script>");
}

解决方案 »

  1.   

    少东西
    getElementById("aa");
    少id=aa这个元素
    如果页面上有这个元素就是你在这个元素载入页面前调用了 getEL… 可是试着放在他的后面调动.
    如果没有加上就行了~
      

  2.   

    (@"<DIV id=""enetMeng""  style=""BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; 
    LEFT: 0px; VISIBILITY: visible; BORDER-LEFT: #a6b4cf 1px solid; 1px solid; POSITION: absolute; TOP: -256px; HEIGHT: 157px""> </DIV>
    我有这个id=""enetMeng""  的东西啊,我把双引号去掉也不对
      

  3.   

    GetMessage()
    里面有逻辑问题
    setTimeout(""GetMessage()"",5000)
      

  4.   

    setTimeout( "GetMessage();", 5000); ?