Script 15.4 Calculator basic

Includes javascript 15.5 - Uses jQuery to process a simple calculator form and alert the results.

Output

Widget Cost Calculator

Source
	<!-- Script 15.4 - calculator.html -->
<h1>Widget Cost Calculator</h1>
<p id="results"></p>
<form action="<?php echo htmlentities( $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ); ?>" method="post" id="calculator">
	<p id="quantityP">
		<label for="quantity">Quantity</label>
		<input type="text" name="quantity" id="quantity" />
	</p>
	<p id="priceP">
		<label for="price">Price</label>
		<input type="text" name="price" id="price" />
	</p>
	<p id="taxP">
		<label for="tax">Tax (%)</label>
		<input type="text" name="tax" id="tax" />
	</p>
	<p>
		<input type="submit" name="submit" id="submit" value="Calculate!" />
	</p>
</form>