The assignment is to create a simple form that someone would use to order a desk, with options to customize how many drawers, what kind of finish, that kind of thing. Then you click a 'calculate' button and the javaScript calculates the total cost of the desk and returns the value. Right now I've got the form completed, and am trying to make it calculate the square footage of the desk using the inputted width and depth values. Here's the code I have so far:
<html>
<head>
<title>Brion Bastian's JavaScript homework site</title>
<script language="javascript" type="text/javascript">
function calculatesqft(a,b) {
return a*b
}
</script>
</head>
<body bgcolor="#ffffff">
<form>
Size</br>
Width: <input type="text" size="10" name="width" /></br>
Depth: <input type="text" size="10" name="depth" /></br>
Price per sq. ft. <input type="text" size="10" name="pricesqft" /></br>
Total: <input type="text" size="10" name="total" /></br></br>
Drawers</br>
<input type="checkbox" name="OneDrawer" value="no" />One Drawer</br>
<input type="checkbox" name="TwoDrawer" value="no" />Two Drawer</br>
<input type="checkbox" name="ThreeDrawer" value="no" />Three Drawer</br>
<input type="checkbox" name="FourDrawer" value="no" />Four Drawer</br>
<input type="checkbox" name="FiveDrawer" value="no" />Five Drawer</br></br>
Veneer</br>
<input type="checkbox" name="Plastic" value="yes" />Plastic</br>
<input type="checkbox" name="Oak" value="no" />Oak</br>
<input type="checkbox" name="SolidOak" value="no" />Solid Oak</br></br>
Hardware</br>
<input type="checkbox" name="PlasticHardware" value="yes" />Plastic</br>
<input type="checkbox" name="MetalHardware" value="no" />metal</br></br>
<input type="text" name="total">
<input type="submit" value="Calculate" on_Click=alert(calculatesqft(5,6))>
</form>
</body>
</html>
___________________________________________
<html>
<head>
<title>Brion Bastian's JavaScript homework site</title>
<script language="javascript" type="text/javascript">
function calculatesqft(a,b) {
return a*b
}
</script>
</head>
<body bgcolor="#ffffff">
<form>
Size</br>
Width: <input type="text" size="10" name="width" /></br>
Depth: <input type="text" size="10" name="depth" /></br>
Price per sq. ft. <input type="text" size="10" name="pricesqft" /></br>
Total: <input type="text" size="10" name="total" /></br></br>
Drawers</br>
<input type="checkbox" name="OneDrawer" value="no" />One Drawer</br>
<input type="checkbox" name="TwoDrawer" value="no" />Two Drawer</br>
<input type="checkbox" name="ThreeDrawer" value="no" />Three Drawer</br>
<input type="checkbox" name="FourDrawer" value="no" />Four Drawer</br>
<input type="checkbox" name="FiveDrawer" value="no" />Five Drawer</br></br>
Veneer</br>
<input type="checkbox" name="Plastic" value="yes" />Plastic</br>
<input type="checkbox" name="Oak" value="no" />Oak</br>
<input type="checkbox" name="SolidOak" value="no" />Solid Oak</br></br>
Hardware</br>
<input type="checkbox" name="PlasticHardware" value="yes" />Plastic</br>
<input type="checkbox" name="MetalHardware" value="no" />metal</br></br>
<input type="text" name="total">
<input type="submit" value="Calculate" on_Click=alert(calculatesqft(5,6))>
</form>
</body>
</html>
___________________________________________