[Javascript] Hopefully quick question.

David Dorward david at dorward.me.uk
Sat Oct 3 14:03:58 CDT 2009


On 3 Oct 2009, at 19:36, Terry Riegel wrote:

> I have this construct...
>
> <script>
>  var obj=$('mydiv');
>  obj.onclick=function() {
>   alert(obj.id);

> I want to pass that function the value of obj at the time it is set  
> up.


Possible, but this is easier:

  obj.onclick=function() {
   alert(this.id);

-- 
David Dorward
http://dorward.me.uk




More information about the Javascript mailing list