html - Javascript function not called when id and function name same -
i want know effect of id
, function
when both same. example:
<tr> <td><img id='deleteauthor' onclick='javascript: deleteauthor(this)' src='images/close.png' /></td></tr>"; function deleteauthor(element){ alert(element); } output:typeerror: deleteauthor not function [break on error] <tr> <td><img id='deleteauthorbt' onclick='javascript: deleteauthor(this)' src='images/close.png' /></td></tr>"; function deleteauthor(element){ alert(element); } output:object htmlimageelement
please why behave so?
u have use different names id , function. same names both cause ambiguity
Comments
Post a Comment