我很难尝试创建一个 javascript 文件来验证我的带有选项和数量的示例表单。我想要做的是当一个人填写表格并且出现错误时,我想要一个弹出窗口来说明原因。如果它好,典型的显示将是订购物品的摘要、每件物品的数量、每件物品的成本和总成本。
所以简而言之,如果客户订购了一些东西,我希望显示器能显示他们订购的东西以及含税总额。
<!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>
<title>Products & Services</title>
</head>
<body>
<h1>PC Products</h1>
<form action="" name="products" method="POST">
<table summary="Feedback">
<tr>
<td>Processors:
<select name="product1">
<option>Select Device</option>
<option value="139.99">Intel i3 - $140</option>
<option value="189.99">Intel i5 - $190</option>
<option value="239.99">Intel i7 - $240</option>
</select>
Quantity :
<select name="quantity1" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</tr>
</td>
<tr>
<td>Storage:
<select name="product2">
<option>Select Device</option>
<option value="149.99">SSD 128GB - $149.99</option>
<option value="249.99">SSD 256GB - $249.99</option>
<option value="519.00">SSD 512GB - $519.00</option>
<option value="69.99">HDD 500GB - $69.99</option>
<option value="109.99">HDD 1TB - $109.99</option>
<option value="149.99">HDD 1.5TB - $149.99</option>
<option value="199.99">HDD 3TB - $199.99</option>
</select>
Quantity :
<select name="quantity2" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</tr>
</td>
<tr>
<td>
Memory:
<select name="product3">
<option>Select Device</option>
<option value="59.99">DDR3 8GB - $59.99</option>
<option value="109.99">DDR3 16GB - $109.99</option>
<option value="209.99">DDR3 32GB - $209.99</option>
</select>
Quantity :
<select name="quantity3" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</tr>
</td>
<tr>
<td>Graphics Card:
<select name="product4">
<option>Select Device</option>
<option value="139.99">Nvidia - $649.99</option>
<option value="189.99">AMD - $449.99</option>
</select>
Quantity :
<select name="quantity4" >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</tr>
</td>
<br />
<table> Service and Repair
<tr><td><input type="checkbox" name="service" value="99.99">
<td>Virus Removal</td> <td align="right"><tt>99.99</tt></td></tr>
<tr><td><input type="checkbox" name="service" value="29.99">
<td>1 Hour Computer Lessons</td> <td align="right"><tt>29.99</tt></td></tr>
<tr><td><input type="checkbox" name="service" value=49.99">
<td>PC Assembly</td> <td align="right"><tt>49.99</tt></td></tr>
</table>
<br />
<h4><i>*Sales Tax of 8.25% applies</i></h4>
<td>Tax exempt check box:
<input type="checkbox" name="reply" value="yes" /><br />
<p>
<input type="hidden" id="itemname" name = "itemname" value= "">
<input type = "submit" value="Submit" />
<input type = "reset" value="Clear" />
</p>
</td>
</form>
</body>
</html>