View Full Version : problem with appendChild and childNodes

07-09-2007, 07:37 PM
I'm having a problem in Firefox when trying to make a dynamically generated div jump to the front onclick. These are the two functions in question. The first is fired when the user clicks a link and the second fires when the user clicks on the div created by openWindow().

These work fine in IE, but Firefox doesn't seem to see the dynamically created divs. Please help.

function openWindow(windowAddress, windowName){
newDiv = document.createElement('div')
newDiv.id = windowName
newDiv.style.border= "1px solid black"
newDiv.style.background = "#FFFFFF"
newDiv.style.position = "absolute"
newDiv.style.top = "60px"
newDiv.style.left = "10px"
new Ajax.Updater(newDiv, windowAddress, {asynchronous:true, evalScripts:true}); return false;

function bringToFront(windowId){
openWindows = $(windowId).parentNode.childNodes
for(i=0; i<openWindows.length; i++){
if (openWindows[i] == $(windowId)){
$(windowId).style.zIndex = '99'
openWindows[i].style.zIndex = '1'

07-09-2007, 09:34 PM
Turns out the problem has to do with the way Firefox handles whitespace... if you are really interested let me know and I will post my findings, otherwise feel free to ignore this post altogether.