Tag Archives: JavaScript

The History Object In JavaScript

The history object is also part of the window object and it provides information about the browser history of the current window.

The history object has only one property which is called length. The lenght property returns the number of pages in the session history of the browser for the current window (including the currently loaded page).

alert("You viewed " + history.length + " page(s).");

Continue reading

Mousedown, Mousemove, Mouseover, Mouseout, and Mouseup Events

The Mousedown event occurs when the user press down the mouse button but before the click is complete. The event handler used for this event is onmousedown

The Mousemove event occurs when the user moves the mouse cursor. The event handler used for this event is onmousemove.

The Mouseover event occurs when the user moves the mouse cursor over an element on the web page. The event handler used for this event is onmouseover.


<a href="http://saigon.ro" onmouseover = "window.alert('Link to another page.');" >Link to another page </a>

Continue reading

The Change Event (onchange)

The Change event occurs when the viewer changes something within a form element. The event handler used for
this event is onchange.


   <select onchange = "window.alert('DO NOT change that');">
     <option selected="selected">Yes</option>

Event handlers in HTML Elements

An event handler is a predefined JavaScript property of an object that is used to handle an event on a web page.
When a viewer of a web page performs an action such as clicking a button, moving the mouse over a particular part of the web page etc means that an event is taking place. JavaScript can identify these events and react to them making the web page more interactive and useful.

Event handlers can can be place within HTML elements as attributes or they can be placed between <script> and </script> tags or in an external JavaScript file.

To use an event handler within an HTML document you need to know the keyword for that event handler.


     <input type="button" value="Click Here" onclick="window.alert(Hi there!);" />

Continue reading