function to remove all child nodes
by rajesh[ Edit ] 2009-09-19 10:07:21
You can use the following javascript function to remove all children of a given parent node
function removeChildNodes(obj)
{
if(obj.hasChildNodes() && obj.childNodes) {
while(obj.firstChild) {
obj.removeChild(obj.firstChild);
}
}
}
so if you want to remove everything from the page, you can just call the javascript function as
<script language=javascript>
removeChildNodes(document.body);
</script>