Here is the best example that I can create. The value of the innerHTML appears in the alert triggered by the onload function. When it hits the document.write, the same innerHTML becomes null. Any ideas on how to get the innerHTML to appear outside the onload function? I've tried global variables and even copying the value to hidden inputs and it still comes up null.
<html>
<head>
<script language='javascript'>
function onload_function() {
alert(document.getElementById("sample_size").innerHTML);
}
document.write("this is a test: " + document.getElementById("sample_size").innerHTML);
</script>
</head>
<body onload='onload_function()'>
<form name='form_test'>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td id='sample_size' style='display:none'>16</td>
</tr>
</table>
</form>
</body>
</html>