:: Forum >>
Adding image with a onclick event
All,
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
KArel
BTW I am aware that you can make the grid itself editable but that is not what i am after.
Karel Bokhorst
Monday, May 21, 2007
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.setAttribute('type','button')
button.setAttribute('value','edit')
button.onclick = function () { alert('edit')}
newtd.appendChild(button)
allrows[i].appendChild(newtd)
}
}
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.
Wednesday, May 23, 2007
Neo (TrioteX)
Saturday, May 26, 2007
Neo (TrioteX)
Saturday, May 26, 2007
This topic is archived.
Back to support forum
Forum search