I can’t get a javascript to call a function on one click. I would have to click the button several times in order for it to execute. here is what I have tried so far:
<a href="javascript:delete_todo(4);void(0)"><img border="0" align="absmiddle" src="b_x.gif"></a>
<a href="javascript:delete_todo(4)"><img border="0" align="absmiddle" src="b_x.gif"></a>
<a href="javascript:void(0);" onclick="javascript:delete_todo(4)"><img border="0" align="absmiddle" src="b_x.gif"></a>
<a onclick="javascript:delete_todo(4)"><img border="0" align="absmiddle" src="b_x.gif"></a>
The code is added by another javascript function that adds the line of code to a table td using .innerHTML
Has anyone had this problem and found a solution?
Event handlers should always be in the onclick. Using
javascript:is bad form.