[Javascript] Problem w/Javascript, interpolation, functions, onclick

Matt Warden mwarden at gmail.com
Wed Oct 25 10:50:27 CDT 2006


On 10/25/06, Nathan V. Patwardhan <nvp at noopy.org> wrote:
>     <span id="addthis" onclick="function1(this)">Add This</span>
>     <span id="cancel" onclick="function2(this)">Cancel</span>
>   </td>
>
> I pass 'this' to a function -- since 'this' represents the current span
> that was selected.  My code finds the last (third) cell in the current
> row (of 'this'), and modifies contents of the same table row to reflect
> which of the spans was selected.

I am not sure whether onclick will fire on spans in all browsers. But,
assuming it will, try this instead of passing 'this':

http://mwarden.f2o.org/sandbox/getidfromeventhandler.js




-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the Javascript mailing list