How to make striped table rows with Javascript
By Chris on November 23, 2011 in php
0
1
1. Enter this Javascript in the head of your page along with the latest jquery pack ( http://docs.jquery.com/Downloading_jQuery )
<script type=”text/javascript” src=”** your scripts folder ***/jquery-latest.pack.js”></script>
<script type=”text/javascript”>
$(function(){
$(“table.tablerow tr:even”).addClass(“oddrow”);
});
</script>
2. Then create a line of CSS in your stylesheet:
.oddrow td { background-color:#eee }
3. Then add the class ‘tablerow’ to your HTML table
And that’s it!
0 Comments
Leave a reply
Leave a Reply
You must be logged in to post a comment.