Hi guys
I am new to DHTML. Would really appreciate if some1 cud help me out. Having prbs with memory leaks….
Here is my code which is really simple ..
<HTML>
<HEAD></HEAD
<body onbeforeunload=”cleanup();”>
<div id=”parentDiv”> </div>
<script>
var parentDiv = document.getElementById(“parentDiv”);
var childDiv = document.createElement(‘DIV’);
childDiv.id = “childNode”;
childDiv.innerHTML = “Hello World”;
parentDiv.appendChild(childDiv);
//cleanup();
function cleanup()
{
parentDiv.removeChild(childDiv);
childDiv = null;
parentDiv = null;
}
</script>
</BODY>
</HTML>
If I check this code using “Drip!” its show that there is a memory leak with childDiv. I would assume that my cleanup() function is not doing its job.
However, I explicitly called the cleanup() removing it from the onbeforeunload event, where it cleaned everything and DRIP! didnt show any memory leaks.
I am baffled .. can any1 point me as to what I am missing or where I am going wrong …
Many many thanks in advance.
Tyl