devxlogo

Multiple Actions on One Event

Multiple Actions on One Event

To put two actions for one onmouseover=” ” event, just separate the two actions with a semicolon just like you would any two JavaScript statements. For example:

 OnChange="alert('First Action');alert('Second Action')"

However, if you have more than one action for an event, I recommend putting those actions into a function at the beginning of your HTML file, and then calling that function in response to the event. This will make your code more manageable and easier to read. For example:

 

devx-admin

Share the Post: