IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Faire un lien sur toute une ligne d'un tableau


Sujet :

JavaScript

  1. #1
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut Faire un lien sur toute une ligne d'un tableau
    Bonjour,
    J'ai besoin de votre aide car j'aimerai faire un lien sur toute une ligne d'un tableau d'enregistrement mais je n'arrive pas à faire le script javascript, la seule chose que je fais pour l'instant est le lien sur une colonne, donc j'aimerai que le lien marche en cliquant sur n'importe quel endroit de la ligne.
    merci d'avance pour votre aide.

  2. #2
    Expert éminent sénior

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Points : 79 915
    Points
    79 915
    Par défaut
    Bonjour,

    Pourrions-nous voir votre code et vos tests ?

  3. #3
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut
    mon tableau est le suivant( en fait j'utilise zen framework) donc c'est ma vue.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
     
    <table class="table-fo-recrutement" cellpadding="4" cellspacing="1" border="0">
    		<tr>
    			<th colspan="5"><?php echo $this->offreMavant->translateReturned; ?></th>
    		</tr>
    		<tr>
    			<th><?php echo $this->titre->translateReturned; ?><br></th>
    			<th><?php echo $this->contrat->translateReturned; ?><br></th>
    			<th><?php echo $this->domaine->translateReturned; ?><br></th>
    			<th><?php echo $this->remuneration->translateReturned; ?><br></th>
    			<th><?php echo $this->date->translateReturned; ?><br></th>
    		</tr>
    			<?php $nbOffres = count($this->listOffresMA); ?>
    			<?php if($nbOffres > 0):?>
    			<?php $cptOffres = 0;?>
    			<?php foreach($this->listOffresMA as $offre): ?>
    			<?php if(($cptOffres % 2) == 0):?>
    				<?php $class = "td2";?>
    			<?php else: ?>
    				<?php $class = "td1";?>
    			<?php endif ?>		
    			<tr class="<?php echo $class;?>" onmouseover="this.className='tdover'" onmouseout="this.className='<?php echo $class;?>'">
    			    <td><a class='link-domaine'	href="/recruthor/index/voir-offre/offreId/<?php echo $offre->offreId;?>/lang/<?php echo $offre->langCode;?>"><?php echo $offre->offreTitre; ?></a></td>
    				<td><?php echo $offre->contratTitre; ?></td>
    				<td><?php echo $offre->domaineTitre ; ?></td>
    				<td><?php echo $offre->offreRemuneration ; ?>€</td>
    				<td><?php echo $offre->offreDateModif; ?></td>
    			<?php $cptOffres++;?>
    			<?php endforeach; ?>
    			<?php endif; ?>
    			</tr>
    	</table>

  4. #4
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut
    je fais le lien sur la première colonne du tableau, j'aimerai le faire sur toute la ligne.

  5. #5
    Expert éminent sénior

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Points : 79 915
    Points
    79 915
    Par défaut
    Attention de nous donner le code HTML généré et non le code PhP.

    Avec un onclick sur le <tr>, vous pourriez sans doute faire un location.href.

  6. #6
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut
    j'ai essayé avec un onclick sur le tr mais ça ne marche toujours pas.
    ce que j'ai fais:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <tr onclick="document.localtion.href='/recruthor/index/voir-offre/offreId/<?php echo $offre->offreId;?>/lang/<?php echo $offre->langCode;?><?php echo $offre->offreTitre; ?>'" class="<?php echo $class;?>" onmouseover="this.className='tdover'" onmouseout="this.className='<?php echo $class;?>'">

  7. #7
    Expert éminent sénior

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Points : 79 915
    Points
    79 915
    Par défaut
    Peut-être à cause d'une lettre en trop dans "localtion" ? Et le fait que ce soit un attribut de window et non de document ?


  8. #8
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut
    merci pour la remarque , j'ai corrigé et ça ne marche toujours pas:

  9. #9
    Expert éminent sénior

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Points : 79 915
    Points
    79 915
    Par défaut
    Montrez-nous le code HTML généré (clic-droit afficher source).

  10. #10
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut
    avec un click droit ça donne ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
     
    <table class="table-fo-recrutement" cellpadding="4" cellspacing="1" border="0">
    		<tr>
    			<th colspan="5">Offres mises en avant</th>
    		</tr>
    		<tr>
    			<th>Titre de l'offre<br></th>
     
    			<th>type de contrat<br></th>
    			<th>Domaine d'activité<br></th>
    			<th>Rémunération annuelle<br></th>
    			<th>Date de publication<br></th>
    		</tr>
     
    			<tr onclick="window.location.href='/recruthor/index/voir-offre/offreId/1/lang/frdeveloppement'" class="td2" onmouseover="this.className='tdover'" onmouseout="this.className='td2'">
    			    <td><a class='link-domaine'	href="/recruthor/index/voir-offre/offreId/1/lang/fr">developpement</a></td>
     
    				<td>CDI</td>
    				<td>developpement</td>
    				<td>25000€</td>
    				<td>16/06/2011 18:00:28</td>
     
    			<tr onclick="window.location.href='/recruthor/index/voir-offre/offreId/9/lang/froffre en developpement'" class="td1" onmouseover="this.className='tdover'" onmouseout="this.className='td1'">
    			    <td><a class='link-domaine'	href="/recruthor/index/voir-offre/offreId/9/lang/fr">offre en developpement</a></td>
     
    				<td>CDI</td>
    				<td>developpement</td>
    				<td>254500€</td>
    				<td>16/06/2011 11:44:27</td>
     
    			<tr onclick="window.location.href='/recruthor/index/voir-offre/offreId/5/lang/frCommerce, vente, distribution'" class="td2" onmouseover="this.className='tdover'" onmouseout="this.className='td2'">
    			    <td><a class='link-domaine'	href="/recruthor/index/voir-offre/offreId/5/lang/fr">Commerce, vente, distribution</a></td>
     
    				<td>CDD</td>
    				<td>commercial</td>
    				<td>32400€</td>
    				<td>16/06/2011 10:29:15</td>
     
    			<tr onclick="window.location.href='/recruthor/index/voir-offre/offreId/4/lang/frGestion, comptabilité, management des entreprises'" class="td1" onmouseover="this.className='tdover'" onmouseout="this.className='td1'">
    			    <td><a class='link-domaine'	href="/recruthor/index/voir-offre/offreId/4/lang/fr">Gestion, comptabilité, management des entreprises</a></td>
     
    				<td>stage</td>
    				<td>gestion commercial</td>
    				<td>32000€</td>
    				<td>16/06/2011 10:22:04</td>
     
    			<tr onclick="window.location.href='/recruthor/index/voir-offre/offreId/3/lang/frmaintenance informatique'" class="td2" onmouseover="this.className='tdover'" onmouseout="this.className='td2'">
    			    <td><a class='link-domaine'	href="/recruthor/index/voir-offre/offreId/3/lang/fr">maintenance informatique</a></td>
     
    				<td>interimaire</td>
    				<td>informatique</td>
    				<td>30650€</td>
    				<td>16/06/2011 10:19:55</td>
    												</tr>
    	</table>

  11. #11
    Expert éminent sénior

    Avatar de vermine
    Profil pro
    Inscrit en
    Mars 2008
    Messages
    6 582
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2008
    Messages : 6 582
    Points : 79 915
    Points
    79 915
    Par défaut
    Essayez en enlevant les premiers "/" :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    window.location.href='/recruthor

  12. #12
    Membre du Club
    Femme Profil pro
    Ingénieur étude et développement
    Inscrit en
    Novembre 2009
    Messages
    125
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur étude et développement

    Informations forums :
    Inscription : Novembre 2009
    Messages : 125
    Points : 55
    Points
    55
    Par défaut
    Et voila ça marche bien, Merci beaucoup pour votre aide

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [HTML 4.0] mettre un lien sur toute une ligne de tableau
    Par sizvix dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 04/11/2010, 15h02
  2. Cliquer sur tout une ligne d'une DataGridView
    Par Lutine dans le forum VB.NET
    Réponses: 14
    Dernier message: 25/07/2007, 13h19
  3. [VBA-E]Couleur de cellule sur toute une ligne
    Par Kaiba dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 20/03/2007, 11h01
  4. [Debutant] faire un update sur tout une table
    Par Karibou dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 27/07/2005, 14h44
  5. CSS : un lien qui prend toute une ligne d'un tableau.
    Par pmithrandir dans le forum Mise en page CSS
    Réponses: 7
    Dernier message: 20/04/2005, 16h52

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo