tags:

views:

77

answers:

2

Is there any way or tools I can check which JavaScript function is run after clicking a button in Internet Explorer?

A: 

No, unless it is a JavaScript URL in a href, or a hard-coded onclick (or similar). There is no way to enumerate event listeners.

Matthew Flaschen
While you can't enumerate the listeners from inside Javascript, it is possible to step through them with a debugger, when they are triggered.
Piskvor
+2  A: 

Try the IE8 Script Debugger (under Developer tools (F12)). The Developer Tools have several tabs, one of them is "Script". There, you need to use "start debugging" button (it changes to "stop debugging", as seen in screenshot), and then look for a button with the "pause" (||) symbol on the same toolbar. Note that the

activating Developer Tools break all button

It allows you to set "break on next instruction"; do that and the debugger will open on the next line of JS to be executed. If you step through all the event handlers for the button, you'll see what is called there.

If you have some control over the page, you may want to disable the mouseover and similar handlers, as those will also trigger the debugger.

Piskvor
I can't find the "break on next instruction" button.
Billy
@Billy: Not sure how it's labeled in English; will check on my WinXP machine
Piskvor
It's near the top (under the Script tab, to the left of the "Start Debugging" button), there's no text on it until you hover over it. It looks like a pause button. It says "Break All" when you hover.
Jonathon
@Billy: found it, see screenshots. I was guessing what the label says in English.
Piskvor