Calculating a total from a form
-
Not sure what I'm missing here. When I click the Total Cost button nothing appears in the text input. I've looked over the documents for any syntax errors but I am just not finding it!! This is an assignment. I need to the total to be inside the input text box. I'm just looking for another set of eyes to see if I missed a semicolon or something simple somewhere. HTML:
<!DOCTYPE html>
<!--
A document for exercise5-3.jsAuthor: Trista Woods Date: 27 June 2013 LOG:
-->
<html lang="en">
<head>
<title>Woods | Order Total | Execise 5.3</title>
<meta charset="utf-8" />
<script type="type/javascript" src="j/exercise5-3.js">
</script><!-- revert to external css --> <style type="text/css"> td, th, table {border: thin solid black;} </style>
</head>
<body>
<form action = "">
<h3>Produce Order Form</h3>
<!-- A bordered table for item orders -->
<table>
<tr>
<th>Type of Produce</th>
<th>Price</th>
<th>Quantity</th>
</tr><tr> <th>Apples</th> <td>$0.59/each</td> <td><input type="text" id="apples" size="2" /></td> </tr> <tr> <th>Oranges</th> <td>$0.49/each</td> <td><input type="text" id="oranges" size="2" /></td> </tr> <tr> <th>Bananas</th> <td>$0.39/each</td> <td><input type="text" id="bananas" size="2" /></td> </tr> </table> <!-- Button for retrieving the total --> <p> <input type="button" value="Total Cost" onclick="computeCost();" /> <input type="text" size="5" id="cost" onfocus="this.blur();" /> </p> <!-- Submit and reset buttons -->
-
Not sure what I'm missing here. When I click the Total Cost button nothing appears in the text input. I've looked over the documents for any syntax errors but I am just not finding it!! This is an assignment. I need to the total to be inside the input text box. I'm just looking for another set of eyes to see if I missed a semicolon or something simple somewhere. HTML:
<!DOCTYPE html>
<!--
A document for exercise5-3.jsAuthor: Trista Woods Date: 27 June 2013 LOG:
-->
<html lang="en">
<head>
<title>Woods | Order Total | Execise 5.3</title>
<meta charset="utf-8" />
<script type="type/javascript" src="j/exercise5-3.js">
</script><!-- revert to external css --> <style type="text/css"> td, th, table {border: thin solid black;} </style>
</head>
<body>
<form action = "">
<h3>Produce Order Form</h3>
<!-- A bordered table for item orders -->
<table>
<tr>
<th>Type of Produce</th>
<th>Price</th>
<th>Quantity</th>
</tr><tr> <th>Apples</th> <td>$0.59/each</td> <td><input type="text" id="apples" size="2" /></td> </tr> <tr> <th>Oranges</th> <td>$0.49/each</td> <td><input type="text" id="oranges" size="2" /></td> </tr> <tr> <th>Bananas</th> <td>$0.39/each</td> <td><input type="text" id="bananas" size="2" /></td> </tr> </table> <!-- Button for retrieving the total --> <p> <input type="button" value="Total Cost" onclick="computeCost();" /> <input type="text" size="5" id="cost" onfocus="this.blur();" /> </p> <!-- Submit and reset buttons -->
I think the problem is at your javascript declare statement. Wrong:
<script type="type/javascript" src="j/exercise5-3.js">
Right:
<script type="text/javascript" src="j/exercise5-3.js">
-
I think the problem is at your javascript declare statement. Wrong:
<script type="type/javascript" src="j/exercise5-3.js">
Right:
<script type="text/javascript" src="j/exercise5-3.js">
That was it!! I knew it was something small!