Web Design

(Nancy Kaufman) #1

208


I


n the early days of the Web, a need arose to allow designers to provide some sort of interactivity
for their users. Netscape, at the time the developer of the most popular browser, created a

lightweight scripting language for that purpose. Named JavaScript, it was first introduced with


the Netscape 2 browser in 1996. Although attempts were made to create competing languages,


eventually every browser manufacturer adopted JavaScript in its browsers. The European Computer


Manufacturers Association maintains a standardized version, known more formally as ECMAScript.


Introduction to JavaScript and Ajax


Writing JavaScript
JavaScript is text-based, and can be written in any text editor. Almost
all editors designed for writing Web pages, whether they are code-
based or visual editors, likely provide help in the form of code hints
and syntax highlighting for JavaScript. function hideDiv(){
document.getElementById("specials").style.visibility = "hidden";}function showDiv()
{ document.getElementById("specials").style.visibility = "visible";}

function hideDiv(){
document.getElementById("specials").style.visibility = "hidden";}
function showDiv(){
document.getElementById("specials").style.visibility = "visible";}

Browser Support
Every major modern browser offers full support of JavaScript.
Microsoft’s Internet Explorer officially supports ECMAScript, but
this in effect means support of JavaScript. You can safely
assume that, unless your user has specifically disabled it, all
browsers will run your scripts.

Running JavaScript
In order to run, your JavaScript code must be
interpreted by an application. In most cases, the
application being used to run it will be a Web
browser. However, many other applications support
JavaScript in some form today, so you might also
encounter it being used elsewhere.

FIND A HOTELFIND A HOTELFIND A HOTEL
DowntownDowntownDowntown
NorthNorthNorth
SouthSouthSouth
EastEastEast

WestWestWest

SMTWT F S
123
45678910
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Select Check-In DateSelect Check-In DateSelect Check-In Date

Windows Internet Explorer
Favorites Suggested Sites Web Slice Gallery
Safari

Apple
WebImagesMapsNewsShopping Gmailmore

Yahoo! Google MapsYou TubeWikipediaNews (13) Popular

FileEditViewHistoryBookmarks WindowHelp
Cross-Country with G
+

File EditMozilla Firefox
Most Visited Getting Started Latest Headlines

View History Bookmarks ToolsHelp
a
Free download pdf