topical media & game development
basic-javascript-07-exercises-PickSystem.htm / htm
<html>
<head>
<script language="JavaScript" type="text/javascript">
var CompItems = new Array();
CompItems[100] = 1000;
CompItems[101] = 1250;
CompItems[102] = 1500;
CompItems[200] = 35;
CompItems[201] = 65;
CompItems[202] = 95;
CompItems[300] = 50;
CompItems[301] = 75;
CompItems[302] = 100;
CompItems[400] = 10;
CompItems[401] = 15;
CompItems[402] = 25;
function updateOrderDetails()
{
var total = 0;
var orderDetails = "<H3>Your selected system</H3>";
var formElement;
formElement =
document.form1.cboProcessor[document.form1.cboProcessor.selectedIndex];
total = parseFloat(CompItems[formElement.value]);
orderDetails = orderDetails + "Processor : " + formElement.text
orderDetails = orderDetails + " " + CompItems[formElement.value] + "<br>";
formElement = document.form1.chkCDROM
if (formElement.checked == true)
{
orderDetails = orderDetails + "CD-ROM : " +
CompItems[formElement.value] + "<br>";
total = total + parseFloat(CompItems[formElement.value]);
}
formElement = document.form1.chkScanner
if (formElement.checked == true)
{
orderDetails = orderDetails + "Scanner : " +
CompItems[formElement[0].value] + "<br>";
total = total + parseFloat(CompItems[formElement[0].value]);
}
else if (formElement[1].checked == true)
{
orderDetails = orderDetails + "Mini Tower Case : " +
CompItems[formElement[2].value]
total = total + parseFloat(CompItems[formElement[2].value]);
}
orderDetails = orderDetails + "<P>Total Order Cost is
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.