i want to make it clear just how much contempt i have for this - it's 1996-era crappy web design that would earn you a fail at first school.
in the time it took me to get around javascript's innate unsuitability for the task, i could have done the thing, server-side, with a database back-end, such that it would work in any browser regardless of javascript DOM model, in three different languages.
however, since your heart is set on it
Code:
<?xml version="1.0"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>foo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript">
function cent(amount)
{
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
function calculate()
{
var p1, p2, p3, pt;
p1 = document.test.price1hidden.value * 1;
p2 = document.test.price2hidden.value * 1;
p3 = document.test.price3hidden.value * 1;
pt = p1 + p2 + p3;
document.test.total_price.value = cent(Math.round(pt*Math.pow(10,2))/Math.pow(10,2));
}
</script>
<form name="test" method="post" action="http://www.qkxyq.com/thalasson/mailform.cgi">
<p>
<input name="price1" type="radio" value="0" onclick="javascript:document.test.price1hidden.value='0';calculate();">0.00<br />
<input name="price1" type="radio" value="10" onclick="javascript:document.test.price1hidden.value='10';calculate();">10.00<br />
<input name="price1" type="radio" value="20" onclick="javascript:document.test.price1hidden.value='20';calculate();">20.00<br />
<input name="price1" type="radio" value="30" onclick="javascript:document.test.price1hidden.value='30';calculate();">30.00<br />
<input type="hidden" name="price1hidden">
</p>
<p>
<input name="price2" type="radio" value="0" onclick="javascript:document.test.price2hidden.value='0';calculate();">0.00<br />
<input name="price2" type="radio" value="10" onclick="javascript:document.test.price2hidden.value='10';calculate();">10.00<br />
<input name="price2" type="radio" value="20" onclick="javascript:document.test.price2hidden.value='20';calculate();">20.00<br />
<input name="price2" type="radio" value="30" onclick="javascript:document.test.price2hidden.value='30';calculate();">30.00<br />
<input type="hidden" name="price2hidden">
</p>
<p>
<input name="price3" type="radio" value="0" onclick="javascript:document.test.price3hidden.value='0';calculate();">0.00<br />
<input name="price3" type="radio" value="10" onclick="javascript:document.test.price3hidden.value='10';calculate();">10.00<br />
<input name="price3" type="radio" value="20" onclick="javascript:document.test.price3hidden.value='20';calculate();">20.00<br />
<input name="price3" type="radio" value="30" onclick="javascript:document.test.price3hidden.value='30';calculate();">30.00<br />
<input type="hidden" name="price3hidden">
</p>
<p> </p>
<p>Total: <input type="text" name="total_price"></p>
<p>Name: <input type="text" size="10" maxlength="40" name="Name" /><br />
</p>
<p>Email: <input type="text" size="20" maxlength="40" name="Email" /><br />
</p>
<p><input type="submit" value="Submit" /> <input name="subject" type="hidden"
value="Configuration Details" /> <input name="nextpage" type="hidden"
value="www.cubicomputers.co.uk" /> <input name="emailto" type="hidden"
value="nvening@gmail.com" /></p>
</form>
</body>
</html>
doesn't quite validate, not sure why.
the main differences here from what you had are: variable names cannot be numbers, they must start with a letter or underscore; only referencing variables which exist (you mention "total_price" without declaring it in your calculate() function); using full paths for all DOM elements (i.e. document.formname.elementname.value always)