JavaScript dynamic overlay.
Anyone know why I am getting the following error in IE using the following code? I have tried so much and just can't figure it out. Why does IE not like it?
<script language="JavaScript">
var objOverlay = document.createElement("div");
objOverlay.setAttribute('id', 'overlay');
document.body.appendChild(objOverlay);
</script>
[388 byte] By [
PeejAvery] at [2007-11-20 6:00:38]

# 1 Re: JavaScript dynamic overlay.
I can tell you that convention is type="text/javascript" as I believe the language tag is deprecated. As for the problem, I can't explain that. Is this running before page load? That could explain it.
# 2 Re: JavaScript dynamic overlay.
All is well now. It was not included in the onload event. I have changed my approach to...
<body>
<div id="overlay" style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; background: #000000; display: none;"></div>
For curiosity sake, I am going to go back and play around some more with the event firing to see if that changes.
EDIT: Just as suspected, changing it to the following works also.
window.onload = function(){objBody.appendChild(objOverlay);}