RSS

Tag Archives: Javascript

Add rows(with content) from modal child window to parent window

// description of code here
/*
* This is a function for put data from child window (with data)
* to parent window.
* Make a tabody by id=”addFromMarketingList” into the parent window
*/
function addToList(){
if(window.dialogArguments){
opener = window.dialogArguments;
}
openerTBody = opener.document.getElementById(“addFromMarketingList“);//parent window TBODY

for(var i=0;i<document.forms[0].elements.length;i++){
if(document.forms[0].elements[i].type==”checkbox“){
if(document.forms[0].elements[i].checked){
var parentElementTD = document.forms[0].elements[i].parentElement;
var parentElementTR = parentElementTD.parentElement;
var myTR = opener.document.createElement(“TR“);
myTR.className=”odd“;
for(var j=0;j<parentElementTR.childNodes.length;j++){
var myTD=opener.document.createElement(“TD“);
myTD.innerHTML = parentElementTD.innerHTML;
myTR.appendChild(myTD);
var parentElementTD = parentElementTD.nextSibling;
}
openerTBody.appendChild(myTR);
}
}
}
window.close();
}

 
1 Comment

Posted by on December 23, 2006 in javascript

 

Tags: