aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Identifying events with javascript functions registered Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Identifying events with javascript functions registered" Watch "Identifying events with javascript functions registered" New topic
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
    
    6
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
    
    6
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!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Identifying events with javascript functions registered
 
Similar Threads
Javascript function registration
submit a form on selecting one option
Dynamically create a list of combo box`s, how to get value
Using form:select data on same page
Delay while I type characters in the text box