我找到答案了。哈哈!document.getElementById("showdiv").innerText;bbs.pinluo.com

解决方案 »

  1.   

    document.getElementById("showdiv").innerHTML;
    也可以
      

  2.   

    document.getElementById("showdiv").innerHTML,
    innerText过时啦,兼容性不好,不推荐使用
      

  3.   


    innerText和innerHMTL各有作用,不存在过时的说法。
      

  4.   

    document.getElementById("showdiv").innerHTML; 
      

  5.   

    innerText和innerHMTL 有時候出來結果是不一樣的。
      

  6.   

    具体情况具体分析,如果仅仅只需要文字,你就用innerText,但是如果你是<div id=showdiv><div >我是中国人<div> </div> 这个样子的时候,你不可以用innerHTML。至于为什么嘛,你操作一下就知道了。有区别滴!!
      

  7.   

    用文本节点读取比较好innerHTML可能会读到很多无关信息.
      

  8.   

    document.getElementById("showdiv").innerHTML; 
      

  9.   

    document.getElementById("showdiv").innerHTML;
    document.getElementById("showdiv").innerText;
    document.getElementById("showdiv").firstChild.nodeValue;
      

  10.   

    document.getElementById("showdiv").firstChild.data;