Setting onclick in Javascript.

wxdqz

New Member
I'm creating rows on the fly. When someone presses the add button, a new row pops up. The problem is that I need that row to have functionality, too.

td = row.insertCell();
var qButton = td.appendChild(document.createElement('image'));
qButton.onclick = '"alert(1);"'

Just for an example. This won't fire off an alert when you click the newly created button. When I check out the innerHTML, it reads okay, but the onclick is still useless.

I've tried a number of things .. Taking out the quotation marks, leaving them in .. I've made this work before, but I was using innerHTML, which I can't do right now, as I need it supported for Netscape. Any clues? I'd appreciate it.
 
Back
Top