Reprint: http://msdn.microsoft.com/zh-cn/library/7t96kt3h (v=vs.94). aspx
Gets the function that invokes the current function.
Functionname.caller
Note
The FunctionName object is the name of any function that is executing.
caller property is defined only when the function is executing. null. " If the function is called from the top level of the JavaScript program, then caller contains null.
If the caller property is used in the context of a string, its result and functionname. ToString is the same, that is, the anti-compilation text of the function is displayed.
The following example illustrates the use of the caller property:
1 functionCalllevel () {2 if(Calllevel.caller = =NULL)3 return("Calllevel is called from the top level.");4 Else5 return("Calllevel is called by another function.");6 }7 8 document.write (Calllevel ());9 Ten //Output:calllevel is called from the top level.
Requirements
Supported in the following document modes: Quirks, Internet Explorer 6 standard mode, Internet Explorer 7 Standard mode, Internet Explorer 8 standard mode, Internet Explorer 9 standard mode, INT Ernet Explorer 10 Standard mode and Internet Explorer 11 standard mode. In addition, it is also supported in store apps (Windows 8 and Windows Phone 8.1).
Caller Property (function) (JavaScript)