View Single Post
  #2 (permalink)  
Old Nov 3rd, 2007, 14:32
Rakuli's Avatar
Rakuli Rakuli is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Calc function

Okay so you want to do something like this -- assuming that you are echoing everything to the page with PHP

PHP: Select all



echo '
<script type="text/javascript">
var totalPrice = '
$totalPrice';

function workoutnewPrice(passedObject)
{
    if (passedObject.checked && !isNaN(parseInt(passedObject.value)) {
        totalPrice += parseInt(passedObjec.value);
        alert(totalPrice);
    }  
}
</script>'

Then on your radio buttons add onclick="workoutnewPrice(this)"

Hope that helps,
Reply With Quote