[Javascript] Hopefully quick question.

Terry Riegel riegel at clearimageonline.com
Sat Oct 3 13:36:45 CDT 2009


I have this construct...

<script>
  var obj=$('mydiv');
  obj.onclick=function() {
   alert(obj.id);
  }
  obj=$('myotherdiv');
</script>

Which means when a person clicks on obj the code in that function will  
fire, which will alert the LAST value of obj.

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

I understand how this code works now, what I don't understand is how I  
would make it work the other way.

Any ideas?


Terry


More information about the Javascript mailing list