Показать сообщение отдельно
  #14 (permalink)  
Старый 01.04.2018, 13:01
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,081

denis_kontarev,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  .yes{
    background-color: Blue;
    color:  White;
    font-size: 48px;
     padding: 2px 8px;
     border-radius: 4px;
  }

  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

  <script>
$(function() {
  $("#search").on("input", function() {
    var val = this.value.trim();
    $.each($("#filter tbody tr"), function(i, tr) {
      var td = [].filter.call(tr.querySelectorAll("td:nth-child(n + 6):nth-child(-n + 8)"), function(td) {
        var num = td.textContent.match(/\d+(.\d+)?(?=\s*%)/);
        var ok = true;
        if(isNaN(val) || !val){
          $(td).removeClass("yes")
        }
        else {
            ok  =  num !== null && +val < +num[0];
            $(td).toggleClass("yes", ok)
        }
        return ok;
      });
      $(this).toggle(!!td.length);
    });
  });
});
  </script>
</head>

<body>
<div class="form-group">
<input type="text" class="form-control pull-right" id="search" placeholder="Поиск по таблице">
</div>

<table class="simple" id="filter">

<tr>

<td>00:15</td>

<td style="color:blue;text-align: left;">

<small style="color:black;">
<span>Футбол. Чемпионат Боливии. Лига LFPB</span>
</small>

<br>Ройял Пари - Сан-Хосе Оруро</td>

<td class="yes_volume_cf" style="color:green;font-weight: 600;">
<span style="color:black;">2.63</span>
<small style="color:green;">
<br>(3) 14% <img src="/images/up.png" width="9" height="11" align="center" alt="img"></small></td>

<td class="" style="color:green;font-weight: 600;">
<span style="color:black;">3.3</span>
<small style="color:green;">
<br>(3.36) 2% <img src="/images/up.png" width="9" height="11" align="center" alt="img"></small></td>

<td class="" style="color:green;font-weight: 600;">
<span style="color:black;">2.81</span>
<small style="color:red;">
<br>(2.44) 13% <img src="/images/down.png" width="9" height="11" align="center" alt="img"></small></td>

<td class="">33%</td>
<td class="">30%</td>
<td class="yes">41%</td>

<td>0:2</td>
<td class="yes">12</td>

</tr>


</table>

</body>
</html>

Последний раз редактировалось рони, 01.04.2018 в 13:33.
Ответить с цитированием