Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: problem z wykonaniem kodu js w pliku php
Forum PHP.pl > Forum > Przedszkole
migotka1
wklejam kod j.s. (zmiana koloru tła komórki po wskazaniu myszk±):

onmouseover="this.style.background='#66CCFF';return true;"
style="CURSOR: hand"onmouseout="
this.style.background='white';return true;"
" title="Zobacz w manualu php" target="_manual

do pliku php w znaczniku <td> :

  1. <?
  2.  '
  3. <table><tr>
  4. <td onmouseover="this.style.background='#66CCFF';return true;"
  5. style="CURSOR: hand"onmouseout="this.style.background='white';return true;">jaki¶ tekst</td><tr></table>
  6. ';
  7. ?>

i nie działa! chyba co¶ ze składni±, bo w zwykłym pliku html jest ok
Proszę o wskazówki, dzięki dzięki
bogdan89
przed każdym pojedyńczym apostrofem wstaw \

powinno pomóc winksmiley.jpg
k110
echo
'
<table><tr>
<td onmouseover="this.style.background='#66CCFF';return true;"
style="CURSOR: hand"onmouseout="this.style.background='white';return true;">jaki¶ tekst</td><tr></table>
';
?>

możesz zamienić na np.
this.style.background=\'white\';return true;

PS. A nie lepiej zamiast echo po prostu

php co¶ tam ?> KOD HTML <? dalej php

Pozdrawiam

<?
echo
'
<table><tr>
<td onmouseover="this.style.background=\'#66CCFF\';return true;"
style="CURSOR: hand"onmouseout="this.style.background=\'white\';return true;">jaki¶ tekst</td><tr></table>
';
?>

lub

  1. <?
  2. //kod php
  3. ?>
  4. <table><tr>
  5. <td onmouseover="this.style.background='#66CCFF';return true;"
  6. style="CURSOR: hand"onmouseout="this.style.background='white';return true;">jaki¶ tekst</td><tr></table>
  7. <?
  8. //kod php
  9. ?>
migotka1
Proste i genialne. Dzięki K110 i bogdan89!!
To jest wersja lo-fi głównej zawarto¶ci. Aby zobaczyć pełn± wersję z większ± zawarto¶ci±, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.