kpiatak Posted September 17, 2012 Share Posted September 17, 2012 I have one button, and I need it to perform 2 actions, how would I go about doing this?http://webapps.easy2.com/ce/ext1104/messages/iris_messages.htmlI need to have the bus slide in, then have the phone message appear.I am more of a visual learner, so to have an example would most definitely help. Link to comment Share on other sites More sharing options...
ShadowMage Posted September 17, 2012 Share Posted September 17, 2012 (edited) The function addEventListener can be used to add multiple event handlers. However, it isn't fully cross-browser (IE, as usual, doesn't follow the rules). So, the easier way is to just call your two functions within a wrapper function and asign the wrapper as the handler: function wrapperFunc() { busSliderFunction(); phoneMsgFunction();}element.onclick= wrapperFunc; Or if you want to use an anonymous function, you won't have to define wrapperFunc: element.onclick= function() { busSliderFunction(); phoneMsgFunction();} Edited September 17, 2012 by ShadowMage 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now