| Author |
Identifying events with javascript functions registered
|
Ranadhir Nag
Ranch Hand
Joined: Mar 09, 2006
Posts: 138
|
|
We need to record all javascript events fired/registered against any HTML element on a form. For example,if there is a SELECT element on a form,and there is a javascript function registered against the onchange event of the element,we need to shortlist the 'onchange' event. How do we do this - is there some way to identify the events against which javascript functions have been registerd for any element - (either through IHTMLDocument interface or attachEvent DOM) The purpose is to trigger that event programmatically - i.e we would populate the SELECT element and trigger the javascript 'onchange' event(or any other 'javascripted' event for that matter) through FireEvent. [ December 10, 2006: Message edited by: Bear Bibeault ]
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You would manually have to loop through all the elements and manually test if they contain that event handler. Eric
|
 |
Ranadhir Nag
Ranch Hand
Joined: Mar 09, 2006
Posts: 138
|
|
Thanks Eric. By manual testing do you mean that we would actually have to fire the possible events on each element and check for the result?
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Hint: alert(typeof obj.onchange) Eric
|
 |
Ranadhir Nag
Ranch Hand
Joined: Mar 09, 2006
Posts: 138
|
|
alert(typeof(obj.on<any event> gives me 'object'.
|
 |
Ranadhir Nag
Ranch Hand
Joined: Mar 09, 2006
Posts: 138
|
|
|
In fact type of on any event gives me 'object' - I even tried obj.onjunk!!
|
 |
 |
|
|
subject: Identifying events with javascript functions registered
|
|
|