<table><tr>
<td onmouseover="alert(this.innerText);">H e l l o!</td>
</tr></table>
结果是H e l l o!
怎样才能得到正确的值H e l l o!
<td onmouseover="alert(this.innerText);">H e l l o!</td>
</tr></table>
结果是H e l l o!
怎样才能得到正确的值H e l l o!
只是IE下的话,可以考虑酱紫:
<table>
<tr>
<td onmouseover="alert(this.innerText);"><pre>H e l l o!</pre></td>
</tr>
</table>
window.onload=function(){
document.getElementById("td1").innerText="H e l l o!"
}
</script>
<table> <tr>
<td id="td1" onmouseover="alert(this.innerText);"></td>
</tr> </table>