• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Identifying events with javascript functions registered

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would manually have to loop through all the elements and manually test if they contain that event handler.

Eric
 
Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: alert(typeof obj.onchange)

Eric
 
Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alert(typeof(obj.on<any event> gives me 'object'.
 
Ranadhir Nag
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact type of on any event gives me 'object' - I even tried obj.onjunk!!
 
Are you okay? You look a little big. Maybe this tiny ad will help:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic