This this what I have done, but for some reason I can not see the result…
If anyone can help me with this code… I would appreciate it.
It supposed to be an easy code, but there is something that I am missing.
[code]
<?xml version=”1.0″ encoding=”UTF-8″?>
<!–initial lines of code to indicate the conformance standard applied to the page–>
<!DOCTYPE html
PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en”>
<head>
<script type=”text/javascript”>
function GetTotal()
{
var processorprice = 0;
var harddriveprice = 0;
var memoryprice = 0;
var networkcardprice=0;
var modemprice = 0;
var totalprice =0;
var i;
// Get processor price
for(i=1; i<=3; i++) {
if(document.getElementById(“Proccesor” + i).checked){
processorprice=parseInt(document.getElementById(“Processor” + i).value);
}
}
// Get hard drive price
for(i=1 ;i<=3; i++) {
if(document.getElementById(“HardDrive” + i).checked){
harddriveprice=parseInt(document.getElementById(“HardDrive” + i).value);
}
}
// Get menory price
i=document.getElementById(“Memory”).selectedIndex;
memoryprice=parseInt(document.getElementById(“Memory”)[i].value);
// Get Network Card price
if(document.getElementById(“NetworkCard”).checked){
networkcardprice=parseInt(document.getElementById(“NetworkCard”).value);
}
else
{
networkcardprice=0;
}
// get modem price
if(document.getElementById(“Modem”).checked){
modemprice=parseInt(document.getElementById(“Modem”).value);
}
else{
modemprice =0;
}
// Get total Price
totalprice=1000 + processorprice + harddriveprice + networkcardprice + modemprice;
document.getElementById(“TotalPrice”).value=totalprice;
}
</script>
<title>calculating the cost of a computer.</title>
<style type=”text/css”>
</style>
</head>
<body>
<h1>Computer Pricing</h1>
<form>
<table>
<tr>
<td bgcolor=”#F0F0F0″>Base Price:</td>
<td>$1000</td>
</tr>
<tr>
<td rowspan=”3″ bgcolor=”#F0F0F0″>Processor:</td>
<td><input id=”Processor1″ type=”radio” name=”Processor” value=”0″/>1.5GHz</td>
</tr>
<tr>
<td><input id=”Processor2″ type=”radio” name=”Processor” value=”400″/>2.0GHz (add $400)</td>
</tr>
<tr>
<td><input id=”Processor3″ type=”radio” name=”Processor” value=”600″/>3.0GHz (add $600)</td>
</tr>
<tr>
<td rowspan=”3″ bgcolor=”#F0F0F0″>Hard Drive:</td>
<td><input id=”HardDrive1″ type=”radio” name=”HardDrive” value=”0″/>40GB</td>
</tr>
<tr>
<td><input id=”HardDrive2″ type=”radio” name=”HardDrive” value=”200″/>80GB (add $200)</td>
</tr>
<tr>
<td><input id=”HardDrive3″ type=”radio” name=”HardDrive” value=”0″/>400GB (add $400)</td>
</tr>
<tr>
<td bgcolor=”#F0F0F0″>Memory:</td>
<td>
<select id=”Memory;”>
<option value=”0″>1024 MB</option>
<option value=”300″>2048 MB (add $300)</option>
<option value=”500″>4096 MB (add $500)</option>
<option value=”700″>8192 MB (add $700)</option>
</select>
</td>
</tr>
<tr>
<td bgcolor=”#F0F0F0″>Network Card:</td>
<td><input id=”NetworkCard” type=”checkbox” value=”70″/>(add $70)</td>
</tr>
<tr>
<td bgcolor=”#F0F0F0″>Modem:</td>
<td><input id=”Modem” type=”checkbox” value=”50″/>(add $50)</td>
</tr>
<tr>
<td bgcolor=”#F0F0F0″><input type=”button” value=”Total Price” onClick=”GetTotal()”/></td>
<td>$<input id=”TotalPrice”/ type=”text”><span id=”TotalPrice”></span></td>
</tr>
</table>
</form>
</body>
</html>