Javascript.RU

Создать новую тему Ответ
 
Опции темы Искать в теме
  #1 (permalink)  
Старый 09.11.2015, 14:49
Новичок на форуме
Отправить личное сообщение для sofilin Посмотреть профиль Найти все сообщения от sofilin
 
Регистрация: 09.11.2015
Сообщений: 3

Скрипт калькулятора
Уважаемые форумчане, добрый день.
Помогите разобраться в простом скрипте "калькулятора"
Не как не могу понять где можно поменять формулу ( в скрипте умножить на 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"
});
});
});

Всем спасибо.
Ответить с цитированием
  #2 (permalink)  
Старый 09.11.2015, 16:33
Кандидат Javascript-наук
Отправить личное сообщение для Cache Посмотреть профиль Найти все сообщения от Cache
 
Регистрация: 02.05.2013
Сообщений: 111

а использовать для кода теги (bb-code) не судьба?
Ответить с цитированием
  #3 (permalink)  
Старый 09.11.2015, 18:45
Новичок на форуме
Отправить личное сообщение для sofilin Посмотреть профиль Найти все сообщения от sofilin
 
Регистрация: 09.11.2015
Сообщений: 3

А это 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>
Спасибо за помощь.
Ответить с цитированием
  #4 (permalink)  
Старый 10.11.2015, 01:36
Профессор
Отправить личное сообщение для Rise Посмотреть профиль Найти все сообщения от Rise
 
Регистрация: 07.11.2013
Сообщений: 4,672

Сообщение от sofilin Посмотреть сообщение
Не как не могу понять где можно поменять формулу
На сервере...
Ответить с цитированием
Ответ



Опции темы Искать в теме
Искать в теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Доработать скрипт калькулятора. webmanss Элементы интерфейса 0 19.10.2015 21:23
Не работает скрипт калькулятора в FF 4.0 YaVolodya Firefox/Mozilla 2 01.11.2013 11:04
Мастерам javascript! Помогите отладить скрипт калькулятора Romkinss Работа 3 11.03.2012 15:42
Хочу скрипт! (скрипт калькулятора на сайт) Georgiy Общие вопросы Javascript 6 28.01.2010 15:09
Скрипт калькулятора ЕМС-почты России battrack Ваши сайты и скрипты 2 03.03.2009 20:20