topical media & game development
basic-javascript-appendix-6-ch06-q2.htm / htm
<HTML>
<HTML>
<HEAD>
<SCRIPT>
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 = "";
var formElement;
formElement = document.form1.cboProcessor[document.form1.cboProcessor.selectedIndex];
total = parseFloat(CompItems[formElement.value]);
orderDetails = "Processor : " + formElement.text
orderDetails = orderDetails + " " + CompItems[formElement.value] + "\n";
formElement = document.form1.chkCDROM
if (formElement.checked == true)
{
orderDetails = orderDetails + "CD-ROM : " + CompItems[formElement.value] + "\n";
total = total + parseFloat(CompItems[formElement.value]);
}
formElement = document.form1.chkScanner
if (formElement.checked == true)
{
orderDetails = orderDetails + "Scanner : " + CompItems[formElement[0].value];
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 + "\n\nTotal 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.