SHARE
Facebook X Pinterest WhatsApp

Advanced JavaScript for Web Developers: onClick and onMouseOver

Mar 18, 2010

One of the great things about JavaScript, and why I like it so much, is that it can be quite complicated, such as the hiermenus at the top of this page, or as simple as the many examples in this tutorial. What we’re going to go over here are a certain class of JavaScript functions called “Event Handlers.” These are commands that work directly with existing HTML commands. They work so closely in fact, they work by being embedded right into the HTML command itself.

They’re called Event Handlers because they create events. They do things when your users do things. That’s a terrible description, but I’m on a tight schedule here. Read on…

We’re going to go over a few different Event Handler JavaScript commands here. I’ll list them up front. I want you to keep an eye on the capitalization pattern of each. You must keep that pattern every time you use the command. If you don’t, the commands won’t work. Here are the commands:

 

  • onMouseOver This creates an event when the mouse is passed over active text or image.
  • onMouseOut This creates an event when the mouse is taken off of an active text image.
  • onClick This creates an event when active text or images are clicked on.
  • alert This pops up a dialogue box that contains text and an OK button.

 

Recommended for you...

The Revolutionary ES6 Rest and Spread Operators
Rob Gravelle
Aug 23, 2022
Ahead of Time (AOT) Compilation in Angular
Tariq Siddiqui
Aug 16, 2022
Converting a JavaScript Object to a String
Rob Gravelle
Aug 14, 2022
Understanding Primitive Type Coercion in JavaScript
Rob Gravelle
Jul 28, 2022
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.