Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

314
Vistas
How can i select a row and change the background-color on the select row

Please I need help I have been looking for 4 hours.How can I do this : when the user clicks on one of the lines of the , an “EventListener” must call a function which takes care of modifying the background color of the line concerned. I have to do this in Javascript without including styles directly in the JavaScript code. I had a color in my css file with a class name .select . I will add my html code here to help. The table is in a php file because it is in a php session (that's why there is php in the html). In the php file theres nothing except the information in the table and code for the php session.

HTML:

<table id="tbl_carnet" class="terne">
    <thead id="tbl_carnet_entete">
        <tr class="lignes_titres">
            <th class="entete_nom">Nom</th>
            <th class="entete_bureau">Bureau</th>
            <th class="entete_telephone">Téléphone</th>
            <th class="entete_extension">Extension</th>
            <th class="entete_courriel">Courriel</th>
        </tr>
    </thead>

    <tbody id="tbl_carnet_corps">
        <?php
            for ($i = 0; $i < count($contacts); $i++) {
                echo '<tr class="lignes_corps" id="ligne_' . $i . '">';

                foreach ($contacts[$i] as $typeInfo => $infoContact)
                    echo '<td class="' . $typeInfo . '">' . $infoContact . '</td>';
                                                
                echo '</tr>';
            }
        ?>
    </tbody>

    <tfoot id="tbl_carnet_pied">
        <tr class="lignes_pied">
            <td colspan="6">Dernière mise à jour : mai 2022</td>
        </tr>
    </tfoot>
</table>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda