What is the best way to debug Javascript code using any tool..i.e. i want to know when a button is clicked, what all JS code gets executed...

I wanted to test in Firefox and Safari..Already tried Firebug, but want to know if there is any better way..

Also more importantly i want to know "how" exactly to debug the code?

Also is it possible to print the complete JS code that gets called when I say press a button?

Edit
Report