Javascript 自动行高亮显示

Javascript 自动行高亮显示,javascript,php,html,Javascript,Php,Html,我需要的是自动突出显示具有“KIV”值的整行。“KIV”值是从“masalah”字段下的数据库中获取的 这是我的密码: <table id="myTable" class="w3-table-all w3-small w3-striped w3-hoverable w3-responsive"> <thead> <tr>

我需要的是自动突出显示具有“KIV”值的整行。“KIV”值是从“masalah”字段下的数据库中获取的

这是我的密码:

<table  id="myTable" class="w3-table-all w3-small w3-striped w3-hoverable w3-responsive">
<thead>
            <tr>
                                          
                        <th></th>
                        <th></th>
                        <th class="text-center">Daerah</th>
                        <th class="text-center">Checkers</th>
                        <th>Nama Pesara</th>
                        <th class="text-center">No. Kad Pengenalan</th>
                        <th>No. Fail</th>
                        <th>Jawatan</th>
                        <th >Tarikh Bersara</th>
                        <th>Jenis Bersara</th>
                        <th>Umur Bersara</th>      
                        <th >Tarikh Dokumen Diterima</th>
                        <th>Tarikh Kuiri</th>
                        <th >Tarikh Dokumen Lengkap</th>
                        <th >Tarikh Hantar KPM</th>
                        <th >Tarikh Sokongan KPM</th>
                        <th >Tarikh Hantar KWAP</th>
                        <th >Tarikh Lulus KWAP</th>
                        <th>Catatan</th>
            </tr>
</thead>
<tbody>

<?php
include('connection.php');

if (isset($_GET['page_no']) && $_GET['page_no']!="") {
    $page_no = $_GET['page_no'];
    } else {
        $page_no = 1;
        }

    $total_records_per_page = 20;
  $offset = ($page_no-1) * $total_records_per_page;
    $previous_page = $page_no - 1;
    $next_page = $page_no + 1;
    $adjacents = "2"; 

    $result_count = mysqli_query($con,"SELECT COUNT(*) As total_records FROM rekod_pesara");
    $total_records = mysqli_fetch_array($result_count);
    $total_records = $total_records['total_records'];
  $total_no_of_pages = ceil($total_records / $total_records_per_page);
    $second_last = $total_no_of_pages - 1; // total page minus 1

    $result = mysqli_query($con,"SELECT * FROM rekod_pesara LIMIT $offset, $total_records_per_page");
    while($row = mysqli_fetch_array($result)){

        echo "<tr>  
        
             '<td><a  href="datarekod.php?id='.$row['id'].'" class="btn btn-primary" ></a></td>' .
             "<td class='a'>".$row['masalah']."</td>
              <td>".$row['daerah']."</td>
              <td>".$row['checkers']."</td>
              <td>".$row['nama_pesara']."</td>
              <td>".$row['no_kp']."</td>
              <td>".$row['no_fail']."</td>
              <td>".$row['jawatan']."</td>
              <td>".$row['tarikh_bersara']."</td>
              <td>".$row['jenis_bersara']."</td>
              <td>".$row['umur_bersara']."</td>
              <td>".$row['tar_terima_dok']."</td>
              <td>".$row['tar_kuiri']."</td>
              <td>".$row['tar_lengkap_dok']."</td>
              <td>".$row['tar_hantar_KPM']."</td>
              <td>".$row['tar_sokongan_KPM']."</td>
              <td>".$row['tar_hantar_KWAP']."</td>
              <td>".$row['tar_lulus_KWAP']."</td>
              <td>".$row['catatan']."</td>
              
              </tr>";
        }
       mysqli_close($con);
    ?>
      <script type="text/javascript">
        $('td a').click(function(e){
        // prevent browser following link
        e.preventDefault();
        //open in new window
        window.open(this.href,"","width=1000,height=650,top=100,left=100" );
         });
      </script>

</tbody>
</table>

达拉
跳棋
纳马佩萨拉
编号Kad Pengenalan
不,失败
贾瓦坦
塔里赫·贝尔萨拉
杰尼斯·贝尔萨拉
乌穆尔·贝尔萨拉
塔里克·多库门·迪特里马
塔里克库里
Tarikh Dokumen Lengkap
塔里赫汉塔KPM
塔里克索孔根KPM
塔里克汉塔克瓦普
塔里克·卢卢斯·夸普
卡塔坦

这是一个使用
if
语句的简单例子,或者,如下面的示例所示,将其缩短为

“”

注意:如果要对整行执行此操作,则需要在封闭的
上设置样式,而不是单个
,但基本方法相同。(您的示例代码不包含任何
s,但为了简洁起见,我假定您一定省略了它们。)

您好,我无法完全理解您的代码。例如,你从哪里开始吵架?非常感谢你,朋友。:')我花了将近一周的时间寻找解决方案。最后,我得到了答案。
"<td class='a'".($row['masalah'] == "KIV" ? "style='background-color:red'" : "").">"