Stop Smoking Calculator How much is a packet of 20 cigarettes?        £ How many cigarettes do you smoke per day?
You could save...

jQuery(function ($) { function calc() { var perday = ($("#cost_of_pack").val()/20) * $("#quantity_smoked").val(); var perweek = perday * 7; var permonth = perday * (365 / 12); var peryear = perday * 365; var per10year = perday * 365 * 10; $("#weekly_cost").html("£" + perweek.toFixed(2) + " per week"); $("#monthly_cost").html("£" + permonth.toFixed(2) + " per month"); $("#annual_cost").html("£" + peryear.toFixed(2) + " per year"); $("#10annual_cost").html("£" + per10year.toFixed(2) + " per 10 years"); } $( "#cost_of_pack" ).keyup(function() { calc(); }); $( "#quantity_smoked" ).keyup(function() { calc(); }); $( "#cost_of_pack" ).mouseup(function() { calc(); }); $( "#quantity_smoked" ).mouseup(function() { calc(); }); });