Affichage sous PHP 'AU SECOURS'

Bonjour,

chui un débutant développeur de PHP j'écris

echo "<tr bgcolor='#FFFFCC' onMouseover='this.style.backgroundColor='#9900CC'' onMouseout='this.style.backgroundColor='#FFFFCC''>";

mais malheureusement ne marche pas...j crois l'emplacement d'apostrophe..
merci d'avance pour votre aide...
Configuration: Windows XP
Firefox 2.0.0.11

9 réponses

  • Votes
  • Date
  • Date décroissante
  1. echo "<tr bgcolor='#FFFFCC' onMouseover='this.style.backgroundColor='#9900CC'' onMouseout='this.style.backgroundColor='#FFFFCC' ''>";
    1. Salut CAN2008,

      essaye avec ça plutôt:
      echo "<tr bgcolor=\"#FFFFCC\" onMouseover=\"this.style.backgroundColor=#9900CC\" onMouseout=\"this.style.backgroundColor=#FFFFCC\">";
      Sinon, utilise l'attribut hover de CSS.

      Cordialement,
      Keanjyto.
      1. slt Keanjyto.
        malheureusement sur html marche é sur php ne marche plus aparament problème de guillemets....
        merci
        1. Assure toi d'avoir mis \" comme dans le code de mon précédent post... Le caractère \ annule la fonction PHP de celui qui suit (on dit que c'est un caractère d'échappement).
          1. slt
            voila sur html marche correctement

            <tr bgcolor="#FFFFCC"
            onMouseover="this.style.backgroundColor='#9900CC'"
            onMouseout="this.style.backgroundColor='#FFFFCC'"> alors comment migrer cette écriture sur PHP
            echo.....

            merci
            1. Voilà, j'ai testé et c'est bon...

              --> En HTML tu mets :
              <tr bgcolor="#FFFFCC" onMouseover="this.style.backgroundColor='#9900CC'" onMouseout="this.style.backgroundColor='#FFFFCC'">
              --> En PHP, tu mets :
              <?
              echo "<tr bgcolor=\"#FFFFCC\" onMouseover=\"this.style.backgroundColor='#9900CC'\" onMouseout=\"this.style.backgroundColor='#FFFFCC'\">";
              ?>

              En PHP, c'est testé avec EasyPHP. Bonne continuation.

              Cordialement,
              Keanjyto.