title: removeChild "Node was not found" - cant work it out
body: <p>Here is the code below I am using the remove cells (which have been selected) from a table. It works some of the time, but then other times it brings up a "Node was not found"  code:</p>
  
  <blockquote>
    <p>"8" (NS_ERROR_DOM_NOT_FOUND_ERR)</p>
  </blockquote>
  
  <p>Can't seem to figure how to do it. Any help would be great.</p>
  
  <pre><code>var p = document.getElementById('tableTr');
  while(selectTag=document.getElementsByClassName('tagSelected')) {
      if(!selectTag[0]) {
          break;
      }
      if(selectTag[0].className=="tagSelected")
          var c =selectTag[0];
          p.removeChild(c);
      }
  }
  </code></pre>
  
  <p>I have a PHP script that populates the table and thats about it to my HTML:</p>
  
  <pre><code>&lt;div id="uploadTag"&gt;
      &lt;table class="tagBlock" id="tableTag" cellspacing="5px;"&gt;
  
          &lt;?php 
  
          $uploadlist=substr($uploadlists, 0, -1);
          $uploadList=explode(";",$uploadlist);
          $i=0;
          foreach($uploadList as $key=&gt;$list){
              if($i==0)
              { ?&gt;    
                  &lt;tr id="tableTr"&gt; 
              &lt;?php } 
  
              $i++; $up="up".($key+1); 
              $imageext = substr(strrchr($list, '.'), 1);
              $val=$list;
              if ($imageext=='png' || $imageext=='bmp' || $imageext=='gif' || $imageext=='tif' || $imageext=='jpg')
              {
                  $val="&lt;image&gt;";
              }
  
  
                  ?&gt;&lt;td id="&lt;?php echo $up; ?&gt;" class="tagBlock" title="&lt;?php echo $list; ?&gt;"&gt;&lt;div id="&lt;?php echo $up; ?&gt;" class="tagBlockW" title="&lt;?php echo $list; ?&gt;"&gt;&lt;?php echo "$val"; ?&gt;&lt;/div&gt;&lt;/td&gt; &lt;?php
          if($i==7){ $i=0;?&gt;  &lt;/tr&gt; &lt;?php }?&gt; 
          &lt;?php }
  
          ?&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>