Jump to content

Recommended Posts

Posted

Hey Everyone.

Heres my problem:

I want to make a system to build quotes for Computers. This means, the user Choosing a specific item, and that being added to the total cost, eventually making a printable quote for the user.

My mind is thinking of radio Boxes, each one selection adds to the quote viewable at the side.... I dont know how to do this and it'll just confuse me.

If anyone can give me a clue how this is done (or an example would be better) then i'd be thankful.

Thanks

Luke


Posted

One piece of quick and dirty example. I'm not sure it's error-free, but you should get the general idea :-)

<form name="something" action="somfile.xxx" method="post">
<input type="checkbox" name="quote_0" onclick="updateTotal();" /> Bla bla bla
<div id="totalCost"></div>
</form>
<script language="javascript" type="text/javascript">//<![CDATA[
var numQuotes = 1;
var quotePrices = [4.5];
function updateTotal()
{   var total = 0;
   var quote = 'undefined';
   for (var i=0; i<numQuotes; i++)
   {   quote = document.forms['something'].elements['quote_'+i];
       if (typeof quote != 'undefined' && quote.checked)
       {   total += quotePrices[i];
       }
   }
   document.getElementById('totalCost').innerHTML = 'Total cost: '+ total;
}
updateTotal();
//]]>
</script>

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...