Switch to full style
JQuery Examples
Post a reply

different colors for table Even- Odd rows and Cells

Sat Jan 12, 2013 10:30 pm

different colors for table Even- Odd rows and Cells
javascript code
<html>
<head>
<title>different colors for table Even- Odd rows </title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
$(function() {
$('td:odd').css("background-color", "#F4F4F8");
$('td:even').css("background-color", "#F13131");
$('th:odd').css("background-color", "#00FF30");
$('th:even').css("background-color", "#0030F0");
});
</script>
</head>
<body>

<table border="1">
<tr>
<th>Head Data-1</th><th>Head Data-2</th>
</tr>
<tr>
<td colspan="2" align="center">Row-1 Row-1</td>
</tr>
<tr>
<td colspan="2" align="center">Row-2 Row-2</td>
</tr>
<tr>
<td colspan="2" align="center">Row-3 Row-3</td>
</tr>
<tr>
<td colspan="2" align="center">Row-4 Row-4</td>
</tr>
</table>

</body>
</html>




Post a reply
  Related Posts  to : different colors for table Even- Odd rows and Cells
 change the style of table cells     -  
 Select odd rows from table     -  
 Table Border Colors for PHPBB3     -  
 Listing All Rows and Fields in a Table     -  
 Multi colored table rows     -  
 two Different background colors     -  
 Drawing a triangle with colors     -  
 deal with colors in java     -  
 show Rainbow Colors     -  
 three rows frameset .     -  

Topic Tags

JQuery Table