...

View Full Version : problem with appendChild and childNodes



leeq
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.appendChild(document.createTextNode('Loading...'))
$('content').appendChild(newDiv)
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'
}
else{
openWindows[i].style.zIndex = '1'
}
}
}

leeq
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum