OK,

So it's been a while, but I've been really busy. So, I think I've got some of this Ajax stuff figured out, but I'm really stumpped right now, so I thought I would post this before I pull my hair out. Basically, I'm trying to disable a div element with a bunch of stuff in it after getting a sucessful ajax response. It seems to work if I write it like this:

Code:
 
var id = o.responseText;
   if (document.getElementById('1').hasChildNodes())
  {
      while ( document.getElementById('1').childNodes.length >= 1 )
      {
          document.getElementById('1').removeChild( document.getElementById('1')s.firstChild );       
      } 
  }
But, you see my problem is having to pass a variable ID to the element, so I need a:

Code:
 
var div = "document.getElementById("+id+")";
... to pass the id back from the response. Now, simple, right? But when I write this code, nothing works:

Code:
 
var id = o.responseText;
 var div = "document.getElementById("+id+")";
 
  if (div.hasChildNodes())
  {
      while ( div.childNodes.length >= 1 )
      {
          div.removeChild(div.firstChild );       
      } 
  }
The error in firebug says that div.hasChildNodes() is not a function! Why isn't the string being passed????? AHGRRRHH!!!

Hacking away...