Reputation: 13367
I'm currently working on a very poor developed system, and I have to make some bug fixes before this product is released in beta stage.
The site is built with lots of javascript, and I'm not very familiar with it. The question is - is there a way to read how my function was executed?
Like.. Function was called by onClick, or onMouseOver or something like that.
Thanks in advance!
Upvotes: 0
Views: 49
Reputation: 25164
If you can, pass the event
object to these functions, ie:
<div onclick="ev(event||window.event)" onmouseover="ev(event||window.event)">
The div
</div>
<script>
function ev(e){
// e.type will have the value 'mouseover' or 'click' based on what you do
}
</script>
Upvotes: 1
Reputation: 251172
Firefox has a tool called "Firebug" which lets you debug the JavaScript.
If you select the "Script" tab in Firebug, stick a breakpoint inside the function and then select the "Stack" tab in the right hand panel, you should see the information you need.
If you don't have Firebug, get it here:
https://addons.mozilla.org/en-US/firefox/addon/1843/
Upvotes: 0