Adding image with a onclick event


I am a complete new to javascript (but not to PHP and HTML).
What i try to accomplish is the following:
Read my data from a mysql table into a javascript array .
Next i like to add two columns with an edit icon and a delete icon.
Both images will have an onclick event popping up an other window with an edit form or confirm message.

The access to the mysql works but I like some help in adding the two additional rows with an clickable image.

Anybody have some examples or hints where i can find some information.

Thanks in advance


BTW I am aware that you can make the grid itself editable but that is not what i am after.

Karel Bokhorst
May 21,
The access to the mysql works but I like some help in adding the two additional rows with an clickable image.
^ this means 2 additional columns? if so...
self.insertcolumns = function () {
var allrows = document.getElementsByTagName('TR');
for (var i=0;i<allrows.length;i++) {
var newtd = document.createElement('TD');
var button = document.createElement('INPUT')
button.onclick = function () { alert('edit')}
if you add this function and then do something like <a onclick="insertcolumns()">work damn it..</a> in body of html it should add edit button (that does absolutely nothing) to all rows of all existing tables...
Gene D.
May 23,
Here is a wonderfully working demo by Sudhaker Raj.


Hmm, I note that the site is throwing up an error right now, but, you know, I even saw this page working three days back.

Meanwhile, there are several other working demos in here:

Keep trying the first link, thats what you were exactly looking for (but in J2EE, of course) with nice add/edit/delete popup forms. The grid is kept disabled until these forms are dismissed.

Hope this helps!

Neo (TrioteX)
May 26,
Take a look at his post here:


Neo (TrioteX)
May 26,

This topic is archived.

See also:

Back to support forum