页面中有一个button按钮  当点击这个按钮 响应js 向页面追加一段话<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<input type="button" value="点我加美女" onclick="document.write('美女')"/>
</body>
</html>当点击按钮的时候 美女是写入页面了 可是 按钮没了
我想点击按钮后 在按钮下面显示美女 按钮还是要存在页面原来位置 不知这个怎么弄 不懂 求帮助

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript">
        function add() {
            var div = document.getElementById("divAdd");
            div.innerHTML="美女";
         }
    </script>
    </head>
    <body>
    <input type="button" value="点我加美女" onclick="add();"/>
    <div id="divAdd"></div>
    </body>
    </html>
      

  2.   

    <html>
    <script type="text/javascript">
      function WriteLine()
      {
        document.getElementById('meinv').innerHTML="美女";
      }</script><body>
    <input type="button" onclick="WriteLine()" value="点击美女"/>
    <div id="meinv"></div>
    </body>
    </html>
      

  3.   

    不好意思 页面上没有这个div
    要动态的用js在页面上追加美女
    用document.write方法是不是做不到?
      

  4.   

    我要的是document.write()方法是不是不能写入页面数据
    如果写了数据后 是不是页面原有的数据就没了如果write方法可以 那怎么写? 谢谢
      

  5.   

    如果页面解析完成后再调用document.write方法他就会覆盖原来页面的所有东西了