Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

onclick two function calls  RSS feed

 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Is it possible/what syntax to execute two javascript functions from the onklick event handler?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're doing this under script control (I prefer to keep all behavior out of the HTML markup):


This should give you enough of a clue to figure out how to declare it in HTML markup if that's what you're doing.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. Of coures you'll need to deal with IE's window.event nonsense if the Event instance is important to you.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.P.S. With the DOM Level 2 Event Model, you can assign as many listeners to a DOM element as you like, but IE doesn't support it. Always the life of the party, IE has its own proprietary API. So most people just use the DOM Level 0 Model (what's demonstrated in the previous posts).

Employing a library such as jQuery or Prototype hides all (or at least most) of the event handling browser differences from your code.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!