
Figure 7.5: The hierarchy in DOM
A DOM Application
Listing 7.2 is the HTML page for a JavaScript application to convert prices
from U.S. dollars to Euros. The price list is an XML document. The applica-
tion demonstrates how to use DOM.
A slightly modified version of this page (essentially, putting up a better
face) could be used on an electronic shop. International shoppers could
access product prices in their local currency.
Listing 7.2: Currency Conversion HTML Page
<HTML>
<HEAD>
<TITLE>Currency Conversion</TITLE>
<SCRIPT LANGUAGE=”JavaScript” SRC=”conversion.js”></SCRIPT>
</HEAD>
<BODY>
<CENTER>
<FORM ID=”controls”>
File: <INPUT TYPE=”TEXT” NAME=”fname” ...