I had this html:
<tr id="action" title="click to do something" onclick="alert( 'mike');">
<td>a</td>
<td>b</td>
</tr>
and it works when I click on the row, but when I try to add it
dynamically like:
myTR=document.c reateElement("T R");
myTR.id="action ";
myTR.title="cli ck to do something";
myTR.onclick="a lert('mike');";
myTD=document.c reateElement("T D");
myText=document .createTextNode ("a");
myTD.appendChil d(myText);
myTD=document.c reateElement("T D");
myText=document .createTextNode ("b");
myTD.appendChil d(myText);
myTR.appendChil d(myTD);
myTABLE.appendC hild(myTR);
Nothing is happening when I click on the row. I know some of the
attribute are case sensitive. I tried onclick, onClick, OnClick, none of
them work.
Anyone know what's up?
Mike
<tr id="action" title="click to do something" onclick="alert( 'mike');">
<td>a</td>
<td>b</td>
</tr>
and it works when I click on the row, but when I try to add it
dynamically like:
myTR=document.c reateElement("T R");
myTR.id="action ";
myTR.title="cli ck to do something";
myTR.onclick="a lert('mike');";
myTD=document.c reateElement("T D");
myText=document .createTextNode ("a");
myTD.appendChil d(myText);
myTD=document.c reateElement("T D");
myText=document .createTextNode ("b");
myTD.appendChil d(myText);
myTR.appendChil d(myTD);
myTABLE.appendC hild(myTR);
Nothing is happening when I click on the row. I know some of the
attribute are case sensitive. I tried onclick, onClick, OnClick, none of
them work.
Anyone know what's up?
Mike
Comment