Connecting Tech Pros Worldwide Forums | Help | Site Map

Get running object name

Newbie
 
Join Date: Jun 2009
Posts: 11
#1: Sep 4 '09
Get running object name

Hi
Is it possible to get running object name using a command that defined in same object?


Expand|Select|Wrap|Line Numbers
  1. <script>
  2. var test = function()
  3. {
  4.     this.find = function()
  5.     {
  6.             alert('How can i know that this object is running as "a" variable?');
  7.     }
  8. }
  9. </script>
  10.  
  11. <script>
  12. var a = new test();
  13. a.find(); // Need solution for returning "a"
  14. </script>
  15.  

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,670
#2: Sep 4 '09

re: Get running object name


I think it’s this.callee. search for inheritance, it should be mentioned there.
Reply


Similar JavaScript / Ajax / DHTML bytes