Please format any code in your post using the CODE tag. This makes it a lot easier to read it.
Well, the global array htmlwindow.tobjects[] holds a reference to all DHTML windows (DIV elements) on the page. To remove them, you would do something like:
Code:
for (var i=dhtmlwindow.tobjects.length-1; i>=0; i--)
dhtmlwindow.tobjects[i].parentNode.removeChild(dhtmlwindow.tobjects[i])
A couple of points. Firstly, you should be looping backwards instead of the standard forward, since as you remove a node, the array collapses by one each time. Secondly, removeChild() should be called on the direct parent of the target you're trying to remove. You can test out the above with something like:
Code:
<script type="text/javascript">
function removeall(){
for (var i=dhtmlwindow.tobjects.length-1; i>=0; i--)
dhtmlwindow.tobjects[i].parentNode.removeChild(dhtmlwindow.tobjects[i])
}
</script>
<a href="javascript:removeall()">Remove all windows</a>
Bookmarks