总是提示:window.dzad16 is undefined
 var time_out = 3000;
 function log_start()
 {
 window.dzad16.style.visibility="visible";
 window.setTimeout( "real_log_start()", time_out );
 return false;
 }
 function real_log_start()
 {
 window.dzad16.style.display="none";
 } 
window.onload=log_start();
document.write("<div class=dzad id=dzad16 style=width:650px;height:450px;float=left>");
document.write("<div class=dzad_1 style=position:absolute;z-index:0>");
document.write("<a href=http://127.0.0.1/ad/xhad/Reurl.php?id=16&url=http://www.microsoft.com/china target=_blank><img src=http://127.0.0.1/ad/xhad/Images/kong.gif width=650 height=450 border=0></a></div>");
document.write("<img src=http://127.0.0.1/ad/xhad/Upfiles/46c705ef6d961433c7f5db5fec46e976.jpg width='650' height='450' alt=图片>");
document.write("</div>");

解决方案 »

  1.   

    只有ie支持直接用id引用对象。
    用document.getElementById('dzad16')代替里面的window.dzad16吧。
    另,所有的window对象的方法window都可以省略。
      

  2.   

    window.onload=log_start();
    ==》
    window.onload=log_start;
      

  3.   

     window.dzad16.style.visibility="visible";
    ==>
     document.getElementById("dzad16").style.visibility="visible";
      

  4.   

    你那有可能div还没有生成,就执行了函数
      

  5.   

    换成document.getElementById也一样不行。楼上说的倒是真的,但怎么解决呢
      

  6.   

    document.write("<div class=dzad id=dzad16 style=width:650px;height:450px;float=left>");
    document.write("<div class=dzad_1 style=position:absolute;z-index:0>");
    document.write("<a href=http://127.0.0.1/ad/xhad/Reurl.php?id=16&url=http://www.microsoft.com/china target=_blank><img src=http://127.0.0.1/ad/xhad/Images/kong.gif width=650 height=450 border=0></a></div>");
    document.write("<img src=http://127.0.0.1/ad/xhad/Upfiles/46c705ef6d961433c7f5db5fec46e976.jpg width='650' height='450' alt=图片>");
    document.write("</div>");
     
    var time_out = 3000;
     function log_start()
     {
     window.dzad16.style.visibility="visible";
     window.setTimeout( "real_log_start()", time_out );
     return false;
     }
     function real_log_start()
     {
     window.dzad16.style.display="none";
     } 
    window.onload=log_start();