PoppapumpJ
Programmer
Can anyone tell me why this does not work. It looks the same as other examples, however the function does not execute when the event happens
The addRow function is called from a row in a table. It is creating another row for that table
[tt]
<script>
function ShowMenu(){
alert('got here');
}
function addRow(){
//alert("got here"
var numRows = document.all.testTable.rows.length
var newRow = document.all.testTable.insertRow(numRows - 1)
var newButton = document.createElement ("button"
var newInput = document.createElement("input"
newInput.setAttribute("name", "text1"
newInput.setAttribute("id", ("text" + numRows))
newButton.setAttribute("value", "Select Reason Code"
newButton.attachEvent("onClick", ShowMenu)
newRow.insertCell(0)
newRow.insertCell(1)
newRow.cells(0).appendChild(newInput);
newRow.cells(1).appendChild(newButton);
}
</script>
[/tt]
Thanks for the help
The addRow function is called from a row in a table. It is creating another row for that table
[tt]
<script>
function ShowMenu(){
alert('got here');
}
function addRow(){
//alert("got here"
var numRows = document.all.testTable.rows.length
var newRow = document.all.testTable.insertRow(numRows - 1)
var newButton = document.createElement ("button"
var newInput = document.createElement("input"
newInput.setAttribute("name", "text1"
newInput.setAttribute("id", ("text" + numRows))
newButton.setAttribute("value", "Select Reason Code"
newButton.attachEvent("onClick", ShowMenu)
newRow.insertCell(0)
newRow.insertCell(1)
newRow.cells(0).appendChild(newInput);
newRow.cells(1).appendChild(newButton);
}
</script>
[/tt]
Thanks for the help