Firefox和IE不会运行innertext

Hai*_*ien 0 javascript

我有这样的问题:

<div id='stickyid' style='display:block; color:red'>happi</div>
After write :
<script type="text/javascript">
var thevalue = document.getElementById("stickyid").innerText;
document.write(""+thevalue+""); 
</script>
Run Code Online (Sandbox Code Playgroud)

它可以在Chrome上运行,但不适用于Firefox和IE.我该如何解决?

trr*_*rrm 5

尝试:

var thevalue = document.getElementById("stickyid").innerText || document.getElementById("stickyid").textContent;
Run Code Online (Sandbox Code Playgroud)