get current function name
get current function name
(OP)
Hi All,
Is there a way of retrieving the name of the currently running function?
i.e function x is running and within that function I want to return it's name. Return x (the name of the function)
Thankyou in advance for your help
Is there a way of retrieving the name of the currently running function?
i.e function x is running and within that function I want to return it's name. Return x (the name of the function)
Thankyou in advance for your help
RE: get current function name
CODE
<head>
<script type="text/javascript">
<!--
function someFunc() {
var ownName = arguments.callee.toString();
ownName = ownName.substr('function '.length); // trim off "function "
ownName = ownName.substr(0, ownName.indexOf('(')); // trim off everything after the function name
alert(ownName);
}
someFunc();
//-->
</script>
</head>
</html>
Hope this helps,
Dan
Dan's Page @ Code Couch
http://www.codecouch.com/dan/
RE: get current function name
partymong,
Did the above code work for you?
Dan
Dan's Page @ Code Couch
http://www.codecouch.com/dan/