xXThe JokerXx
08-25-2010, 01:35 AM
i am making a mock website where the user make their own computer by selecting items from drop down menus. then a value of the item comes up below. this works but i am having trouble adding the numbers up for the total cost. here is my code
<html><head><title>build</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
</style></head>
<body>
<script type="text/javascript">
var motherboard = new Array(
'74',
'50',
'73',
'106',
'269',
'64',
'55',
'135',
'47',
'79',
'118',
'163');
var cpu = new Array(
'88',
'104',
'168',
'352');
function changeMotherboard(Mid) {
var ind = document.getElementById(Mid).selectedIndex;
document.getElementById("motherboardDisplay").innerHTML=motherboard[ind];
}
function changeCpu(Cid) {
var ind = document.getElementById(Cid).selectedIndex;
document.getElementById("cpuDisplay").innerHTML=cpu[ind];
}
</script>
</head><body>
<form>
Motherboard
<select id="motherboard" onChange="changeMotherboard('motherboard');">
<option value="0">Asus P5G41C-M-LX G41 DDR2+DDR3</option>
<option value="1">MSI G41M-P33 </option>
<option value="2">Asus P5P41T-LE </option>
<option>G-B H55M-S2H</option>
<option>Asus P7P55D-E-Deluxe</option>
<option>Asus M2N68-AM Plus </option>
<option>ASRock N68S3-UCC </option>
<option>Asus M4A88TD-M-EVO-USB3</option>
</select><br>
</form>
<div id="motherboardDisplay">Select from the list to see price</div>
<form>
CPU
<select name="cpu" id="cpu" onChange="changeCpu('cpu');">
<option value="0">E6500</option>
<option value="1">Core G6950</option>
<option value="2">i3-550</option>
<option>Core i7-930</option>
</select>
<br>
</form>
<div id="cpuDisplay" type = text>Select from the list to see price</div>
<p> </p>
<p>
</body>
</html>
<html><head><title>build</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
</style></head>
<body>
<script type="text/javascript">
var motherboard = new Array(
'74',
'50',
'73',
'106',
'269',
'64',
'55',
'135',
'47',
'79',
'118',
'163');
var cpu = new Array(
'88',
'104',
'168',
'352');
function changeMotherboard(Mid) {
var ind = document.getElementById(Mid).selectedIndex;
document.getElementById("motherboardDisplay").innerHTML=motherboard[ind];
}
function changeCpu(Cid) {
var ind = document.getElementById(Cid).selectedIndex;
document.getElementById("cpuDisplay").innerHTML=cpu[ind];
}
</script>
</head><body>
<form>
Motherboard
<select id="motherboard" onChange="changeMotherboard('motherboard');">
<option value="0">Asus P5G41C-M-LX G41 DDR2+DDR3</option>
<option value="1">MSI G41M-P33 </option>
<option value="2">Asus P5P41T-LE </option>
<option>G-B H55M-S2H</option>
<option>Asus P7P55D-E-Deluxe</option>
<option>Asus M2N68-AM Plus </option>
<option>ASRock N68S3-UCC </option>
<option>Asus M4A88TD-M-EVO-USB3</option>
</select><br>
</form>
<div id="motherboardDisplay">Select from the list to see price</div>
<form>
CPU
<select name="cpu" id="cpu" onChange="changeCpu('cpu');">
<option value="0">E6500</option>
<option value="1">Core G6950</option>
<option value="2">i3-550</option>
<option>Core i7-930</option>
</select>
<br>
</form>
<div id="cpuDisplay" type = text>Select from the list to see price</div>
<p> </p>
<p>
</body>
</html>