Having created a table using DOM how to I add a mouse event to the TD cell
new_cell=document.createElement("TD")
so I get
<td onclick="do_this()"> </td>
liorean
02-17-2004, 03:16 PM
new_cell=document.createElement("TD")
new_cell.onclick=function(e){
e=e||window.event;
do_this();
}
Thanks Liorean that helps, but I still seem to be stuck
I also need to pass two arguments in the function call so I end up with something like this.
<td onclick="do_this('pic1',1)"> <img id="pic1" src""> </td>
<td onclick="do_this('pic2',2)"> <img id="pic2" src""> </td>
so the arguments are relative to the TD contents
liorean
02-17-2004, 05:45 PM
new_cell=document.createElement("TD")
new_cell.onclick=function(e){
e=e||window.event;
do_this(id, number);
}