dynamically generated buttons problem

admin

Administrator
Staff member
Hi,
my code creates buttons which should launch different functions.

function addTable(){
var mCloneNode = myTable.cloneNode(true);
document.body.insertBefore(mCloneNode);
var addinput = mCloneNode.getElementsByTagName("INPUT")[12];
var onclick = "test()";
addinput.setAttribute("ONCLICK", onclick);
addinput.setAttribute("value", "works!");
}

For some reason I'm not able to set "onclick"-attribute (INPUT[12] is a button) while setting "value"-attribute works fine. It holds the "onclick"-attribute from the myTable (original table).

Any ideas?

thanks!
 
Back
Top