209
CHAPTER
Adding Interactivity and Multimedia 9
JavaScript Is Not Java
Java is a very powerful object-oriented programming language from Sun Microsystems, whereas JavaScript is
a scripting language. Except for the name, they in fact have absolutely nothing in common. Although
beginning Web designers commonly confuse the two, care should be taken not to because no help is
available for Java that would be useful for JavaScript programming, and vice versa.
JavaScript and HTML
JavaScript allows developers to achieve many effects not offered by
HTML. For example, HTML form controls are extremely limited, and
offer little in the way of validation mechanisms to ensure that the
data being entered is what is expected. JavaScript allows
developers to write as complicated a validation scheme as they
need on top of the form. JavaScript can also work in conjunction
with CSS to achieve advanced visual effects such as drop-down
menus, accordion effects, and much more.
Ajax
Ajax was developed as a way to allow designers and developers to extend
the capabilities offered by HTML and CSS. Most Ajax development is done
through prebuilt JavaScript libraries, saving you time in having to rewrite
code. The better, more widely adopted libraries focus on good usability
and accessibility, and also provide many features such as the ability for
JavaScript to refresh only a portion of a Web page. The extremely popular
Google Maps application is an example of Ajax.
JavaScript Libraries
Today, many libraries of JavaScript functions exist that enable
developers to implement complex scripting effects while
requiring that they write little or no script themselves. These
libraries free developers from having to spend time coding and
debugging applications, and allow them instead to focus on the
end-user experience.
HTML
<!DOCTYPE html1 PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8 /><title>Untitled Document</title><link href="mainstyles.css" rel="stylesheet" type="text/css" /><script type="text/javascript">
function hideDiv(){ document.getElementById("specials").style.visibility = "hidden";}
function showDiv(){ document.getElementById("specials").style.visibility = "visible";}|
</script></head><body>
<div class="container"> <div class="header"><a href="#"><img src="images/logo.png" alt=Insert Logo Here"name="Insert_logo" width="180" height="90" id="Insert_logo" style="background: #c6d580;display:block;"/></a>
<!-- end .header --></div><div class="sidebar1"> <ul class="nav"> <li><a href="products.html">Products</a></li
<li><a href="services.html">Services</a></li <li><a href="about.html">About Us</a></li <li><a href="locations.html">Locations</a></li </ul>
<p> Use the links above to explore our site.</p><!-- end .sidebar1 --></div>
JAVASCRIPT
GoogleMaps Find businesses, addresses and places of interest. 322 West Main St., Greenleaf, IN Learn more.
W Walnut St.
N (^) Noble
(^) St.
Riley Av
e.
W Walnut St.
W North St. W North St.
Pennsyl
vania S
t.
40 A322 W. Main St.W Main St.^40 MuseumPoet’s^40 W Main St
Rent-a-Ride Prince’sPizza
Church
Church
RestaurantMellon
JavaScript Libraries
Sliding Image Gallery
Bourbon St.Bourbon St.Bourbon St.
Hotel
Skyline
Cemetery
Walking Tour