我正试图获得一个<代码>onclick的活动,以便在一些嵌入的 Java字码中开展工作。
我在咨询许多论坛和书本后,尝试了以多种不同方式登记活动手,并修改《守则》以开展工作。
I m sure it s something simple but I m too close to it to see what the problem is! If any could take the time to advise, I would be most appreciative!
此处摘自超文本文件:
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Order Form</title>
<script type = "text/javascript">
function updateTotal() {
var boltQty = document.getElementbyId("bolt_quantity").value;
var nutQty = document.getElementbyId("nut_quantity").value;
var washQty = document.getElementbyId("wash_quantity").value;
document.getElementById("subtotal").value =
totalCost = (2.15 * boltQty) + (0.45 * nutQty) + (0.15 * washQty);
}
</script>
</head>
<body>
<h3>Order Form</h3>
<form id = "orderform" action = "">
<table border = "1" cellpadding = "3">
<tr>
<th colspan = "8">Product details</th>
</tr>
<tr>
<th>Item</th>
<th>Product Code</th>
<th>Diameter</th>
<th>Length</th>
<th>Colour</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Price</th>
</tr>
<tr>
<td>Bolt</td>
<td>B113</td>
<td>9</td>
<td>50</td>
<td>Black</td>
<td>2.15</td>
<td><input type = "text" id = "bolt_quantity" size = "3" /></td>
<td><input type = "text" id = "row1" onfocus = "this.blur();" size = "3" /></td>
</tr>
<tr>
<td>Nut</td>
<td>N234</td>
<td>5</td>
<td>n/a</td>
<td>Silver</td>
<td>0.45</td>
<td><input type = "text" id = "nut_quantity" size = "3" /></td>
<td><input type = "text" id = "row2" onfocus = "this.blur();" size = "3" /></td>
</tr>
<tr>
<td>Washer</td>
<td>W359</td>
<td>8</td>
<td>n/a</td>
<td>Silver</td>
<td>0.30</td>
<td><input type = "text" id = "wash_quantity" size = "3" /></td>
<td><input type = "text" id = "row3" onfocus = "this.blur();" size = "3" /></td>
</tr>
</table>
<p>
<input type = "button" value = "Subtotal" onclick = "updateTotal();" />
<input type = "text" size = "3" id = "subtotal" onfocus = "this.blur();" />
</p>
<p>
<input type = "submit" value = "Submit Order" />
<input type = "reset" value = "Clear Order Form" />
</p>
</form>
</body>
</html>