不理解你说的,是一个table都不存在,还是知道一个有id的table 不存在??

解决方案 »

  1.   

    是知道一个有id的table 不存在
      

  2.   

    <table id=t1></table>
    <script>
    if(document.getElementById("t1"))
        alert("You");
    else 
        alert("Mei");
    </script>
      

  3.   

    <table id="abcd"></table>
    <script>
    if(abcd.rows.length==0)
    alert('表为空');
    </script>
      

  4.   

    <table id="abc"></table>
    <table id="abcd"><tr><td></td></tr><tr><td></td></tr></table>
    <script>
    if(abcd.rows.length)
    alert('表abcd中有'+abcd.rows.length+'行')
    if(abc.rows.length==0)
    alert('表不存在行');
    </script>
      

  5.   

    关注。我的论坛: www.sokool.cn
      

  6.   

    <script>
    if(document.getElementById('table')==null)
      {
        alert('table doesn't exist');
      }
    else
      {
         if(document.getElementById('table').rows.length==0)
           {
              alert('The rows of this table is 0');
           }
         else
           {
              alert('The rows of this table is '+document.getElementById('table').rows.length);
           }
      }
    </script>