TheSlacker Posted July 21, 2005 Share Posted July 21, 2005 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.ThanksLuke Link to comment Share on other sites More sharing options...
Stalkie Posted July 24, 2005 Share Posted July 24, 2005 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> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now