I have the following code for my website:-
function HCreateWindow(top,left,width,height,zindex,parent) {
var handle = Math.floor(Math.random()*10000000000);
if(parent==null) {
document.write("<div id=\"HWINDOW" + handle + "\"style=\"top: " + top + "px; left: " + left + "px;width: " + width + "px;height: " + height + "px; border: 1px solid black;z-index: " +zindex +"\" class=\"drag\"></div>");
} else {
document.getElementById("HWINDOW" + parent).innerHTML += "<div id=\"HWINDOW" + handle + "\"style=\"top: " + top + "px; left: " + left + "px;width: " + width + "px;height: " + height + "px; border: 1px solid black;z-index: " +zindex +"\" class=\"drag\"></div>";
}
return handle;
}
It turns out that the innerHTML causes internet explorer 8 to say that innerHTML is null or not an object. Thinking that this may be a bug with IE I updated to IE9. Still have the same problem. However, if I add the line before the 'if':-
document.write(parent);
it works, as if innerHTML is recognised. Got no idea how the two commands are related. The only thing is that I do not want to display the contents of 'parent', as this would make the web page untidy. Any clues?
parent?