I'm basically using AJAX and returning a bunch of information through XML and creating a checkbox. If the the XML returns that the checkbox should be set to true, check it, otherwise leave it empty. Below is my iteration when i go through the xml document. also i'd like to have the checkbox call a function when clicked, but I can't get it to work in both IE & Mozilla. Thanks for the help.
Code:
var chkbox = document.createElement('input'); chkbox.type='checkbox'; chkbox.setAttribute('name','chkPortfolio'); chkbox.setAttribute('id',"chkPortfolio_" + (j+1)); chkbox.setAttribute('value',portfolios.childNodes[j].firstChild.data); if( portfolios.childNodes[j].attributes[1].text=="True") { chkBox.onclick= function(evt) { refCell.set } else { chkbox.checked=false; } chkbox.id = "chkPortfolio_" + (j+1); chkbox.li_id = "trPortfolio_" + (j+1); var name = document.createTextNode(portfolios.childNodes[j].firstChild.data); listItem.appendChild(chkbox); listItem.appendChild(name); list.appendChild(listItem); }
Comment