Показать сообщение отдельно
  #7 (permalink)  
Старый 27.08.2016, 10:12
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

калькулятор стилизация при помощи jQuery Form Styler
drkrol,
варианты цены это строки 22 - 29 ...

<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.formstyler/1.7.6/jquery.formstyler.css">
  <script src="https://cdn.jsdelivr.net/jquery.formstyler/1.7.6/jquery.formstyler.min.js"></script>
  <script>
$(function() {
    var inp = $('input[name="time"]'),
        sel = $('select[name="type"]'),
        items = $().add(inp).add(sel),
        price = $(".price");
    items.styler().on("change", function() {
        var t = sel[0].selectedIndex,
            r = inp.index(inp.filter(":checked"));
        price.val({
            1: {
                0: 2500,
                1: 500
            },
            2: {
                0: 2800,
                1: 800
            }
        }[t][r] || 0)
    })
});
  </script>
</head>

<body>
   <select name="type" class="type">
     <option ></option>
     <option>Тип1</option>
     <option>Тип2</option>
   </select>
   <p></p>
   <label>
      <input type="radio" name="time" value="yestime" class="rrad">
      <div class="rtext">Трубы горят</div>
      </label>

      <label>
      <input type="radio" name="time" value="notime" class="rrad">
      <div class="rtext">Время есть</div>
      </label>

     <input type="text" class="price" value="0" readonly>

</body>
</html>
Ответить с цитированием