本帖最后由 xiaopongyou 于 2013-04-07 23:05:31 编辑

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>dom作业</title>
        <script type="text/javascript">
         function change(){
    document.getElementById("content_div").innerHTML=document.getElementById("content_txt").value;
    }
        </script>
    </head>
    <body>
        
        <input id="content_txt" type="text" value="" />
        <input type="button" value="test" id="operation_btn" onclick="change()" />
        <div id="content_div"></div>
    </body>
    </html>
    貌似是那样的
      

  2.   

    <html>
    <head>
        <title>dom作业</title>
        <script type="text/javascript">
    function $(id){
    return document.getElementById(id);
    }
    function funcA(){
    var temp = $("content_txt").value;
    var div = document.createTextNode(temp);
    $("content_div").appendChild(div);

    }
    </script>
    </head>
    <body>
        
        <input id="content_txt" type="text" value="" />
        <input type="button" value="test" id="operation_btn" onClick="funcA()" />
        <div id="content_div"></div>
    </body>
    </html>