I'm used to just using getElementById to look stuff up in my own scripts but I'm doing an assignment and it would not look good to put id's everywhere to modify a html page when there are already name attributes in the elements.
In this page I can't refer to the Family Name input box using
Code: Select all
document.form1.familyNameCode: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>A&B: Order a Pan (Sample Order Form)</title>
<link rel="stylesheet" href="site.css" type="text/css">
</head>
<body>
<!-- Page-wide header -->
<div id="header">
<h1>Welcome to A & B<br>
Pots and Pans Ltd.</h1>
</div>
<!-- Leftmost column contents -->
<div id="left">
<h2>Visit:</h2>
<p><a href="index.html">Home</a></p>
<p><a href="product1.html">Pans</a></p>
<p>Buy a Pan</p>
<p><a href="chart.html">Chart</a></p>
<p><a href="code.html">Code</a></p>
<p> </p>
</div>
<!-- Middle (main) column contents -->
<div id="middle">
<h2>Sample Order Information Form</h2>
<form method="post" action="http://telemat.open.ac.uk/tt281/testform/decode_form.cfm">
<table cellspacing="0">
<tr>
<td><h3>Shipping Information</h3></td>
<td> </td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="firstName" maxlength="30"></td>
</tr>
<tr>
<td>Family Name</td>
<td><input type="text" name="familyName" maxlength="30"></td>
</tr>
<tr>
<td>Contact telephone number</td>
<td><input type="text" name="phoneNumber" maxlength="30"></td>
</tr>
<tr>
<td>Delivery Address</td>
<td>
<textarea name="delivery" rows="8" cols="30">Enter the delivery address.</textarea></td>
</tr>
<tr>
<td><h3>Billing Information</h3></td>
<td> </td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" name="firstName" maxlength="30"></td>
</tr>
<tr>
<td>Family Name</td>
<td><input type="text" name="familyName" maxlength="30"></td>
</tr>
<tr>
<td>Email address</td>
<td><input type="text" name="emailAddress" maxlength="30"></td>
</tr>
<tr>
<td>Contact telephone number</td>
<td><input type="text" name="phoneNumber" maxlength="30"></td>
</tr>
<tr>
<td>Credit Card Number</td>
<td><input type="text" name="cardNumber" maxlength="30"></td>
</tr>
<tr>
<td>Credit Card Type</td>
<td><input type="text" name="cardType" maxlength="30">Visa/MasterCard</td>
</tr>
<tr>
<td>Special Instructions</td>
<td>
<textarea name="instructions" rows="8" cols="30">Enter your requirements here or comments.</textarea></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
<td> </td>
</tr>
</table>
</form>
</div>
<!-- Rightmost column contents -->
<div id="right">
<h2>Your cart:</h2>
<div class="cartitems" id="itemlist">
<p>No items</p>
</div>
</div>
<!-- Page-wide footer -->
<div id="footer">
<p>@2004 A&B Ltd.</p>
</div>
</body>
</html>