Скрипт калькулятора
Уважаемые форумчане, добрый день.
Помогите разобраться в простом скрипте "калькулятора" Не как не могу понять где можно поменять формулу ( в скрипте умножить на 1.02, а нужно сделать умножить на 1.06) Собственно сам скрипт: $(document).ready(function(){ $('.field-type>div>div').click(function(){ $('.field-type .active').removeClass('active'); $(this).parent().addClass('active'); $('#calc-f-type').val($(this).attr('rel')); }); $(':radio[name=srok]').change(function(){ if($(":radio[name=srok]").filter(":checked").val()==1||$(":radio[name=srok]").filter(":checked").val()==2) { $("#calc-f-tar").removeAttr("checked"); } else { if($('#calc-f-sum').val()<=500000) { $("#calc-f-tar").attr("checked","checked" ); } } }); $(':radio[name=type]').change(function(){ if($(":radio[name=type]").filter(":checked").val()==3||$(":radio[name=type]").filter(":checked").val()==2) { $("#calc-f-tar").removeAttr("checked"); } else { if($('#calc-f-sum').val()<=500000) { $("#calc-f-tar").attr("checked","checked" ); } } }); $('#calc-f-s1').change(function(){ if($('#calc-f-s1').attr("checked")) { if($('#calc-f-sum').val()<=500000) { $("#calc-f-tar").attr("checked","checked" ); } } else { $("#calc-f-tar").removeAttr("checked"); } }); $('#calc-f-sum').change(function() { if($('#calc-f-sum').val()<=500000) { $('#calc-f-tar').removeAttr("disabled"); } else if($('#calc-f-sum').val()>500000) { $('#calc-f-tar').attr("disabled","disabled"); $("#calc-f-tar").removeAttr("checked"); } }); $('input').change(function(e){ e.preventDefault(); $('#calc-result').html(''); $.ajax({ type: 'POST', url: "/post/calc/", data: { sum: $('#calc-f-sum').val(), type: $(":radio[name=type]").filter(":checked").val(), srok: $(":radio[name=srok]").filter(":checked").val(), tar: $('#calc-f-tar').is(':checked'), c1: $('#calc-f-s1').is(':checked'), c2: $('#calc-f-s2').is(':checked') }, success: function(data) { $('#calc-result').html(data); }, error: function(data) { }, dataType: "html" }); }); }); Всем спасибо. |
а использовать для кода теги (bb-code) не судьба?
|
А это html страница, куда собственно выводиться калькулятор:
<li class="breadcrumbs__item breadcrumbs__item-home" style="margin: 0px 10px 0px 0px; padding: 0px; border: 0px; outline: 0px; position: relative; float: left; white-space: nowrap; list-style-type: none;"><a href="pigluh.ru/" class="breadcrumbs__link" style="margin: 0px; padding: 0px; border: 0px; outline: 0px;">Главная</a></li> <li class="breadcrumbs__item breadcrumbs__item-current" style="margin: 0px 10px 0px 0px; padding: 0px; border: 0px; outline: 0px; position: relative; float: left; white-space: nowrap; list-style-type: none;">Калькулятор</li> </ul> <p><img alt="" src="/static/files/image/layout/calc.jpg" /></p> <p> </p> <h1>Калькулятор</h1> <p> </p> <div id="calc-holder"> <div style="width:50%; float: left;"> <form false;' method="post" action="/post/calc/"> <div style="margin-bottom:20px;" class="field-price">Введите сумму займа <input type="text" id="calc-f-sum" name="sum" maxlength="15" style="margin: 0 5px; width: 100px; margin-bottom: 1px; vertical-align: middle; border-radius: 8px;" /> руб.</div> <div> <div style="background:url(/static/images/layout/u p.png) no-repeat;" class="field-options"> <p class="field-header">срок займа</p> <label><input type="radio" value="1" name="srok" /> 10 дней </label> <label><input type="radio" value="2" name="srok" /> 20 дней </label> <label><input type="radio" checked="checked" value="3" name="srok" /> месяц</label></div> <div style="background:url(/static/images/layout/m idle.png) no-repeat;" class="field-options"> <p class="field-header">тип ТС, оставляемого в залог</p> <label><input type="radio" checked="checked" value="1" name="type" /> легковой автомобиль </label> <label><input type="radio" value="2" name="type" /> грузовой автомобиль </label> <label><input type="radio" value="3" name="type" /> спецтехника</label></div> <div style="background:url(/static/images/layout/d own.png) no-repeat;" class="field-options"> <p class="field-header">льготы</p> <label><input type="checkbox" checked="checked" id="calc-f-s1" value="1" name="uchet" /> автомобиль снят с учета</label> <label><input type="checkbox" checked="checked" id="calc-f-s2" value="1" name="klient" /> постоянный клиент</label> <label><input type="checkbox" checked="checked" value="1" id="calc-f-tar" name="tarif" /> действует акция 2% </label></div> </div> </form> </div> <div style="float:left; margin-top:70px; font-size:14px; margin-left:50px;"> <div class="calc-result-wrapper"> <div id="calc-result"> </div> </div> </div> </div> Спасибо за помощь. |
Часовой пояс GMT +3, время: 09:00. |