错误提示是错误: oDataGrid has no properties
源文件:http://localhost/demo/
行:93

解决方案 »

  1.   

    也就是这一行
    for(var i=1;i < oDataGrid.rows.length;i++)
      

  2.   

    <table width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    <script type="text/javascript">
    window.onload = function () {
    var ta = document.getElementsByTagName("table")[0];
    ta.rows[0].style.backgroundColor = "#000000";
    ta.rows[1].style.backgroundColor = "#CCCCCC";
    };
    </script>
      

  3.   

    getElementByIds("DataGrid1") 是什么??
    你写错了还是你自己定义的??
    用:
    document.getElementById("DataGrid1"),
    应该没错!
      

  4.   

    不好意思 我自己定义的
    function getElementByIds(swfId) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[swfId]
        }
        else {
            return document[swfId]
        }
    }
      

  5.   

    <!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=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <table id="DataGrid1" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    <script type="text/javascript">
    window.onload = function () {
    var ta = document.getElementById("DataGrid1");
    ta.rows[0].style.backgroundColor = "#000000";
    ta.rows[1].style.backgroundColor = "#CCCCCC";
    };
    </script></body>
    </html>这个是正确的!!!
      

  6.   

    不好意思 我自己定义的
    function getElementByIds(swfId) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[swfId]
        }
        else {
            return document[swfId]
        }
    }
    -------------------------------
    不要这样用,直接用document.getElementById(),这个在IE和FF下面都可以用!
      

  7.   

    muxrwc(十月,改变) 
    =======
    这个我还在测试  但是我看不出来我写的跟你的有什么不同
      

  8.   

    <table id="t"><tr><td>q</td></tr></table>
    <script>
    document.getElementById('t').rows[0].style.backgroundColor="red";
    </script>这样是可以兼容IE,FF的,你参考一下自行解决吧!