First off, wrap your code in code tags, html code in html tags and php code in php tags. That is bbcode style tags.
Secondly, indent your code.
Now, to your code. Start by validating your code. It will not pass. Among other things, you use uppercase letters in attribute names, such as onClick, which is valid HTML but invalid XHTML. Then you close your input tags with /> which is valid XHTML and invalid HTML.
Furthermore, in your script, neither car, nor service nor other refer to a defined variable, and as such they do not refer to any element.
radioButton = document.getElementById ("service" + i);
if (radioButton.checked ==true) {
// radioButton is defined and refers to an element. service, car and other do not.
// perhaps change all "radioButton" above to "service"
cost += parseInt (service.value) * parseInt(car.value) + parseInt(other.value);
}
Then, cost == null will ALWAYS be false, since you start out by var cost = 0, and then do not modify it unless a radio button actually has been checked. As such, not clicking any radio button means this will be 0.
Start by going through the cars' radio buttons
found = false;
for(carIndex = 1, car = true; car && !found; ++carIndex) {
car = d.getElementById('car'+carIndex);
if (car && car.checked)
found = true;
}
if (!car) {
alert('No car selected');
return;
}
carVal = parseInt(car.value);
Then fix your cost == null part
// before the loop in your posted script
var noService = true;
// inside loop and if(service.checked)
noService = false;
// change if (cost == null) to
if (noService)
Also, do get the extra value
var extra = 0;
var other = d.getElementById('other')
if (other.checked)
extra = parseInt(other.value);
And finally change the calculation to
cost += parseInt (service.value) * carVal) + extra;