Advertisement

08.07.2008 at 10:11AM PDT, ID: 23630190 | Points: 500
[x]
Attachment Details

creating div elements dynamically

Asked by ukapu2005 in JavaScript, JScript

Please look at the below function. I am having problem in addinjg childelements to the div reference.
I am experiencing problem with savePrintSelect.appendChild(newdiv). Can some one help me to resolve thus issue.

function populatePrintSelect(printSelectArray){
    var savePrintSelect = dialogArguments[0].document.getElementById('popupSavePrintDiv');
     for (index in printSelectArray) {
       var newdiv = document.createElement('div');
       var text = document.createTextNode(printSelectArray[index]);
       var divIdName = 'my'+index+'Div';
       newdiv.setAttribute('id',divIdName);
       newdiv.onmouseover="this.style.backgroundColor='#000000'; this.style.color='#FFFFFF'";
       newdiv.onmouseout="this.style.backgroundColor='#F5F5F5'; this.style.color='#000000'";
       //newdiv.innerHTML = printSelectArray[index];
       newdiv.appendChild(text);
       savePrintSelect.appendChild(newdiv)
     }
   
  }Start Free Trial
[+][-]08.07.2008 at 10:33AM PDT, ID: 22183286

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2008 at 11:33AM PDT, ID: 22183876

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628