<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title></head><body>
<table id="t"></table>
</body>
</html>
<script type="text/javascript" language="javascript">document.getElementById("t").innerHTML=123;
</script>为什么最后一行在ie中报错呢.. 谷歌就没问题.js

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title></head><body>
    <span id="t"></span>
    </body>
    </html>
    <script type="text/javascript" language="javascript">document.getElementById("t").innerHTML=123;
    </script>
    在IE中,表格的innerHTML是只读的,不能写
      

  2.   

    一般不设置table的innerHTML的    你改成div试试<div id="t"></div>