Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onclick two function calls

 
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
Pie
Posts: 64838
86
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
Pie
Posts: 64838
86
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
Pie
Posts: 64838
86
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic