Questo è il codice di esempio praticamente i risultati della variabili devono sommarsi e apparire nella cella della tabella
Codice PHP:
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
link rel="stylesheet" type="text/css" href="stile.css" />
<
script src="e-commerce.js" type="text/javascript"></script>

<title>Esempio di calcolo spesa</title>
</head>

<body>
<h1>Shopping</h1>
<div id="box">
<h2>Jeans</h2>
[img]immagini/06levis.jpg[/img]


Costo 50 &euro;</p>
<form method="post" action="#" id="modulo1">
<fieldset>
<legend>Articoli uomo</legend>
<label for="art1">Numero di jeans </label><input type="text" id="art1" size="3" onblur="calcolo" />
</fieldset>
</form>
</div>
<div id="box2">
<h2>Camicia</h2>
[img]immagini/camiciauomo_jeans_a2petto.gif[/img]


Costo 30 &euro;</p>
<form method="post" action="#" id="modulo2">
<fieldset>
<legend>Articoli uomo</legend>
<label for="art2">Numero di camicie </label><input type="text" id="art2" size="3" onblur="calcolo" />
</fieldset>
</form>
</div>
<div id="box3">
<table>
<caption>Totale</caption>
  <tr>
    <td >Euro</td>
    <td id="euro">0</td>
  </tr>
  <tr>
    <td>Dollaro</td>
    <td id="dollaro">0</td>
  </tr>
</table>
</div>
</body>
</html>