Nie działa mi kolorowanie wierszy, próbowałem już różnych sposobów z jquery, ale lipa.
kod strony:
<!DOCTYPE html>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> <script type='text/javascript' src='javascript.js'></script> <script type="text/javascript" src="jquery-1.7.1.js"></script>
<script type="text/javascript"> $(function() {
$("tr:even").addClass("striped");
//$("table tr:nth-child(even)").addClass("striped");
});
<link rel="stylesheet" type="text/css" href="style.css" />
Nazwa produktu:
<input type='text' id='nazwa' /> <br />Cena produktu:
<input type='text' id='cena' /><br /><input type='button' onclick='ajaxFunction()' value='Dodaj' /> <div id='ajaxDiv'>Your result will display here
</div>
W divie o id='ajaxDiv' wchodzi ajaksowany plik php- tutaj fragment od wstawiania tabeli:
.....
$display_string = '<table>';
$display_string .= '<tr>';
$display_string .= '<th>Produkt</th>';
$display_string .= '<th>Cena</th>';
$display_string .= '</tr>';
// Insert a new row in the table for each person returned
$display_string .= '<tr>';
$display_string .= '<td>'.$row['nazwa'].'</td>';
$display_string .= '<td>'.$row['cena'].'</td>';
$display_string .= '</tr>';
}
$display_string .= '</table>';
?>
Nadmienię, że wszystko chodzi poprawnie, więc nie rozumiem skąd ten problem. Główka tabeli (th) "łapie kolor", ale co drugi wiersz już tego nie chce:(
Czy ktoś mi pomoże wskazując błąd
Ten post edytował marcwars 29.11.2011, 22:07:58