by newbie » Wed Feb 08, 2006 1:59 pm
Hi Caleb !
Here is what I made to create windows on the fly.
It works under IE and Firefox.
First, I added 2 DIVs in the main HTMl code:
* one with id "mainWindow" (where all new windows are displayed)
* one with id "ajaxHTML" having style="display:none"
I get the HTML code of the window using AJAX.
The AJAX answer is then processed that way :
var ajaxHTML=document.getElementById("ajaxHTML");
var mainWindow=document.getElementById("mainWindow");
ajaxHTML.innerHTML =responseText;
if (document.all) {
var currentDiv= ajaxHTML.childNodes[0];
} else {
var currentDiv= ajaxHTML.childNodes[1];
}
mainWindow.appendChild(currentDiv);
You can then call initWindows...
By the way, I created a delete function :
function deleteWindow()
{ switchElement(false,document.getElementById('dhtml_goodies_id' + this.id.replace(/[^\d]/g,'')));
activeWindow.parentNode.removeChild(activeWindow);
}
An "individual" init of the new created window would be better if you need to use cookies !
Herve