/** * jQuery.colorize * Copyright (c) 2008 Eric Karimov - ekarim57(at)gmail(dot)com | http://franca.exofire.net/jq/ * Dual licensed under MIT and GPL. * Date: 6/24/2008 * * @projectDescription Table colorize using jQuery. * http://franca.exofire.net/jq/node/3 * * @author Eric Karimov * @version 1.1.0 * * @param {altColor, bgColor, hoverColor, hiliteColor} * altColor : alternate row background color * bgColor : background color (The default background color is white). * hoverColor : background color when you hover a mouse over a row * hiliteColor : row highlight background color * @return {jQuery} Returns the same jQuery object, for chaining. * * @example $('table').colorize(); * * @$('table').colorize({bgColor:'#EAF6CC', hoverColor:'green', hiliteColor:'red'}); * * All the parameters are optional. * Fixed a bug introduced in the original version 1.0.0 that highlighted also the other tables on a page */ jQuery.fn.colorize= function(params) { options= { altColor : '#ECF6FC', bgColor: '#fff', hoverColor : '#BCD4EC', hiliteColor : 'yellow' }; jQuery.extend(options, params); return this.each(function(){ $(this).find('tr:odd').css('background', options.bgColor); $(this).find('tr:even').css('background', options.altColor); var x =$(this).find('tr'); for (var i=0;i