Posts

Showing posts from December, 2009

Very simple striped table with row hover effect

JQuery made it very easy to do this task .... and just with basics of JQuery .JQuery allows us to find all the alternate rows of a table with tbody tr:even selector . We just need to apply a class to all the even rows thats it . To give some hover effect we can use mouseover and mouseout events . In mouseover we are just adding a class and in mouseout we are removing a class. JQuery code : <script type="text/javascript" language="javascript"> $(document).ready(function() { // Initialise the table $("#table-1 tbody tr:even").addClass("even"); //To add a class to even rows $("#table-1 tbody tr:odd").addClass("odd"); $("#table-1 tbody tr td").addClass("BorderBottom"); //To add horizontal border $("#table-1 thead tr ").addClass("header");// Add class to header row $("#table-1 tbody tr").mouseover(function(){ $(this).addClass("over"); }); $("#tab...