<div   id="d1"   style="Z-INDEX:   3;   LEFT:   100px;   WIDTH:   554px;   POSITION:   absolute;   TOP:   600px;   HEIGHT:   200px">  
<input id="btnView1" type="button" value="查看1" onclick="return btnView1_onclick()" />
</div>----------function btnView1_onclick() {
document.write("Google在办公工具软件领域正式向微软发起了挑战");
  
}这样只在网页的左上角显示,怎样让它显示在div层中呢?

解决方案 »

  1.   

    document.all.d1.innerText = "Google在办公工具软件领域正式向微软发起了挑战";
      

  2.   

    不行呀。  我用document.all.d1.innerText = "Google在办公工具软件领域正式向微软发起了挑战";     倒是可以在d1的位置显示文字了,但是的d1却不显示了。   
    在.aspx的“源”页面中用
    document.all.d1.innerText = "Google在办公工具软件领域正式向微软发起了挑战"; 
    d1.style.display="block"; 
    或则将input作为服务器控件,用
    d1.InnerText = "Google在办公工具软件领域正式向微软发起了挑战";
    d1.Visible = true;都不能让div显示呀。怎样才能让“Google在办公工具软件领域正式向微软发起了挑战”显示在d1中,并且d1也显示呀?另外在page_load事件中写
    if(!Page.IsPostBack)
    {
        d1.Visible = true;
    }
    也不行。
      

  3.   

    <html>
    <head></head>
    <body>
    <div   id="d1"   style="display:none;Z-INDEX:   3;   LEFT:   100px;   WIDTH:   554px;   POSITION:   absolute;   TOP:   600px;   HEIGHT:   200px">  </div>
    <input id="btnView1" type="button" value="查看1" onclick="return btnView1_onclick()" />
    <script>
    function btnView1_onclick() {
    document.all.d1.innerText="Google在办公工具软件领域正式向微软发起了挑战";
     document.all.d1.style.display="block"; 
    }
    </script>
    </body>
    </html>
      

  4.   

    你的TOP太大了,不往下拉看不到文字