tags:

views:

116

answers:

1

I need to create the below on my page but don't know how to code it. I am not a programmer so please be as specific as possible. Thanks.

If you have [ -- USER INPUTS VALUE HERE -- ] referrals and they refer [ -- USER INPUTS VALUE HERE -- ] who refer [ -- USER INPUTS VALUE HERE -- ] more, you will earn [ -- VALUE BASED ON FORMULA* HERE -- ].

*The formula is: VALUE 1 {times} dollar value {plus} VALUE 2 {times} different dollar value {plus} VALUE 3 {times} third different dollar value

+3  A: 

Using jQuery, something like this:

If you have <input type="text" name="referrals"> ....
<input type="text" name="refer"> ... <input type="text" name="refer2">
... <span id="value"></span>

Then the script:

jQuery().ready($('input').change(function()
{
    var referrals = $('input[name=referrals]').val();
    var refer = $('input[name=refer]').val();
    var refer2 = $('input[name=refer2]').val();
    var dollarValue = 12.3;

    var value = dollarValue * referrals;
    value += dollarValue * refer;
    value += dollarValue * refer2;

    $('#value').text('$' + value.toFixed(2));
}));
Greg