RSS

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

23 Dec

// 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();
}

Advertisements
 
1 Comment

Posted by on December 23, 2006 in javascript

 

Tags:

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

  1. Mohammad Sajjad Hossain

    March 10, 2007 at 5:00 am

    A small description can be better for readers to understand. By the way good job.

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

 
%d bloggers like this: