I am adding a table row dynamcally and adding an HTML select control to it the onChange event does fire. I'm fairly new to javascript and Im wondering if it is something I've done wrong. here is the code snippet I'm using:
var table = document.getElementById("workTable")
if (!table)
alert("can't find table");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
cell1.setAttribute("class", "'leftSideNavFirstColumn'");
var newDD = document.createElement("Select");
newDD.setAttribute("id", "docTypes_" + rowCount);
newDD.setAttribute("name", "docTypes_" + rowCount);
newDD.setAttribute("runat", "server");
newDD.setAttribute("onchange", "AddSelectedText('" + newDD.id + "')");
var selectObj = document.
getElementById("first_DocTypes");
for (var i = 0; i < selectObj.options.length; i++) {
newDD.options[i] = new Option(selectObj.options[i].text, (selectObj.options[i].value));
}
cell1.appendChild(newDD);
Thanks!
Mike