1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
var divName = "divPopup";
function pop_out() {
var properties="width=400,height=400,top=110,left=100,screenY=50,screenX=100,resizable=yes,scrollbars=yes,location=no";
var newWindow = window.open("templatePopup.html", "", properties);
setTimeout(function(){
var divDest = newWindow.document.getElementById(divName);
var divSrc = document.getElementById(divName);
copyChilds(divSrc, divDest);
}, 500);
}
function copyChilds(divSrc, divDest) {
// suppression
while (divDest.childNodes.length > 0) {
divDest.removeChild(divDest.firstChild);
}
// copie
for(i = 0; i < divSrc.childNodes.length; i++) {
divDest.appendChild(divSrc.childNodes[i].cloneNode(true));
}
// suppression
while (divSrc.childNodes.length > 0) {
divSrc.removeChild(divSrc.firstChild);
}
}
function pop_in() {
var divDest = parent.window.opener.document.getElementById(divName);
var divSrc = document.getElementById(divName);
copyChilds(divSrc, divDest);
window.close();
} |
Partager