Hi all,
I have tried to use a simple javascript function to reformat a page after loading. However, IE6 (on Win XP, both 6.0.2900 and 6.0.0-something) sometimes (the problem is not consistent) waits before executing the function given in the onload tag of the body element. It appears as if it was waiting for the web server, but immediately continues if the user triggers something on the page. Then, miraculously, the problem disappears, and IE executes the script every time as expected. The problem appears to occur after booting for a couple of page loads.

In one case when the problem persisted for several page reloads, I've managed to comment everything out of the called function except an alert(), so I'm pretty sure the function itself was not called. The alert appeared only when I moved the cursor over an element which created a new div; then IE continued normally, called the function, and finished loading the page. Any ideas what might cause this behaviour? Please see the relevant code and the page structure below:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function myonload(){
if (navigator.appName.indexOf("Microsoft")!=-1) {
  tdwidth=document.getElementById('contenthold').offsetWidth-20;
  tdem=1.334*parseInt(document.getElementById('contenthold').currentStyle.fontSize);
  document.getElementById('contentid').style.width=Math.max(20*tdem,Math.min(tdwidth,40*tdem))+'px';
  footerheight=document.getElementById("footertr").offsetHeight;
  document.getElementById('middletr').style.height=(document.body.offsetHeight-document.getElementById("headertr").offsetHeight-footerheight)+'px';
}}
</script>
</head>
<body onload="myonload();">
<table style="width:100%;">
<tr id="headertr"> ... </tr>
<tr id="middletr">
  <td> ... </td>
  <td id="contenthold">
    <div id="contentid"> ... </div>
  </td>
  <td> ... </td>
</tr>
<tr id="footertr"> ... </tr>
</table>
</body></html>
Many thanks!