Cover by Brian Fling

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

JavaScript

The scripting language supported by all major browsers is JavaScript. In an unfortunate naming accident, JavaScript has often been mistakenly considered to be Java’s younger sibling, but this is far from the truth, as the two languages have completely different pedigrees. JavaScript shares much with Microsoft VBScript, but is more ubiquitous across browser platforms.

JavaScript is entirely client-side: all the code is run on the browser’s computer, not on the server. JavaScript functions can be included from external files, stored in the document’s header element, and inline with the HTML. These functions are “fired” on the client at specific times during the page’s lifecycle (such as when the document has been loaded), by timers, or via user interaction (such as clicking and hovering).

Although rather humble in this respect, JavaScript is also rather powerful, and is the foundation for a variety of other technologies that power Web 2.0.

DHTML

Of these other technologies, the most obvious (and most simple) is Dynamic HTML, or DHTML. It is a technique, rather than a standard, for modifying the content of the web page and providing an application-like look and feel. Simply put, DHTML uses JavaScript to modify page elements dynamically. JavaScript functions modify either the styles or the HTML elements.

The most common is show/hide, which allows you to hide content using the CSS display: none; property; then, when the user touches the element, it changes to display: block;. This ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required