MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaEmacsUnicode ♥
Web Hosting by 1&1

JavaScript: On Mouse Over Example

Xah Lee, 2005, …,

This page shows a simple JavaScript example of mouse-over event.

Move your mouse On Me.

Here's the HTML code:

<p>Move your mouse <span id="id7798">On Me</span>!</p>

Following is the JavaScript code:

document.getElementById("id7798").onmouseover = function () {alert('You moused over me!');} ;

This is a simple example of a Event. The event is onmouseover, attached to the “span” tag. When user moves the mouse over the word, the browser detects it and fires the event, then calls the javascript function (the event handler) attached with that event. In this case, the code is just alert('You moused over me!');.

blog comments powered by Disqus