<div id="div_table_1" class="dropdown">
</div>
 var strTable="<table id=table1 border=0 cellpadding=0 cellspacing=0  bordercolor=#397DBD bgcolor=#6d9cd1>";
strTable+="<tr><td >台式机</td></tr><tr><td>服务器</td></tr><tr><td>笔记本</td></tr><tr><td>打印机</td></tr><tr><td>网络产品</td></tr></table>";
div_table_1.innerHTML = strTable;

解决方案 »

  1.   

    innerHTML:请出该用该方法的节点下的HTML代码,但不包括该节点本身的HTML代码
    outerHTML:请出该用该方法的节点及该节点下的HTML代码
      

  2.   

    Prior to the W3C DOM specification, Microsoft invented a property of all element objects:innerHTML. This property first appeared in IE4, and became popular due to its practicality.
    The property’s value is a string containing HTML tags and other content, just as it would appear in an HTML document inside the current element’s tags. Even though the W3C DOM working group did not implement this property for the published standard, the property proved to be too practical and popular for modern browser makers to ignore. You can find it implemented as a de facto standard in Mozilla-based browsers and Safari, among others.
    To show you the difference in the approach, the following code example shows the same content creation and insertion as shown in the previous W3C DOM section, but this time with the innerHTML property:
    // accumulate HTML as a string
    var newHTML = "<p class=’centered’>Thanks for visiting, ";
    newHTML += document.forms[0].firstName.value;
    newHTML += "</p>";
    // blast into placeholder element’s content
    document.getElementById("placeholder").innerHTML = newHTML;
      

  3.   

    呵,打错很多字哦
    innerHTML:得出调用该方法的节点下的HTML代码,但不包括该节点本身的HTML代码
    outerHTML:得出调用该方法的节点及该节点下的HTML代码<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script type="text/javascript">
    function getinnerHTML()
    {
    var e=window.document.getElementById("try");
    alert(e.innerHTML);
    }
    function getouterHTML()
    {
    var e=window.document.getElementById("try");
    alert(e.outerHTML);
    }
    </script>
    </head>
    <body>
    <table width="100%" border="1" cellspacing="0" cellpadding="0" id="try">
      <tr>
        <td>点击下面按钮获得表格的innerHTML各outerHTML</td>
      </tr>
    </table>
    <p>
      <input type="button" name="Submit2" value="innerHTML" onClick="getinnerHTML()">
      <input type="button" name="Submit" value="outerHTML" onClick="getouterHTML()">
    </p>
    </body>
    </html>
      

  4.   

    innerText应该是标签中的文字,如:<td id='td1'>innerText</td>
      

  5.   

    innerText会将里面的HTML解析成Text,比如&nbsp;会作为" "来处理,"&lt"会转为"<"
      

  6.   

    <div>
      <input>
    </div>
    outerHTML = "<div><input></div>"
    innerHTML = "<input>"