我的div如下: 
<div id = "hello" > hello world !  </div>我如何用js取到 hello world ! 谢谢. 

解决方案 »

  1.   

    document.getElementById("hello").innerText
      

  2.   

    up 或者document.getElementById("hello").innerHTML
      

  3.   

    这样ie可用(好像Opera也可以)兼容的可以这样:document.getElementById('hello').childNodes[0].nodeValue
      

  4.   

    innerText,innerHTML,都可以,firefox下不支持innerText,用textContent,
      

  5.   

    document.getElementById('hello').firstChild.nodeValue;
      

  6.   

    document.getElementById("hello").innerHTML();
      

  7.   

    var divValue = document.getElementById("hello").value;
      

  8.   

    噢,div么的value值,就换个属性吧。 其他文本框都可以用上面这种