Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For a js approach, check out <code>arguments.callee.caller</code>. It gives you the function that called the function you are in and you can recurse up the call stack. There is an example in this thread <a href="http://bytes.com/topic/javascript/answers/470251-recursive-functions-arguments-callee-caller" rel="nofollow">http://bytes.com/topic/javascript/answers/470251-recursive-functions-arguments-callee-caller</a>.</p> <p>Be aware that this may not work in all browsers and you may run in to some unexpected things when you get to the top of the "call stack" or native functions so use at your own risk.</p> <p>My own example works in IE9 and Chrome 10 (didn't test any other browsers).</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body onload="Function1()"&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;script type="text/javascript"&gt; function Function1() { Function2(); } function Function2() { Function3(); } function Function3() { Function4(); } function Function4() { var caller = arguments.callee.caller; var stack = []; while (caller != null) { stack.push(caller);//this is the text of the function. You can probably write some code to parse out the name and parameters. var args = caller.arguments; //this is the arguments for that function. You can get the actual values here and do something with them if you want. caller = caller.caller; } alert(stack); } &lt;/script&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload