All pastes #135994 Raw Edit

Chris

public javascript v1 · immutable
#135994 ·published 2006-08-17 10:46 UTC
rendered paste body
var zebraTables = Class.create();zebraTables.prototype = {	triggerClass: "hoverRows",	tables: Object,	/** INITIALIZE FUNCTION **/	initialize: function () {		this.tables = document.getElementsByClassName(this.triggerClass);		this.tables.each(function(item, index) {			rows = item.getElementsByTagName('tr');			this.applyRowsHover(rows);		}.bind(this));	},	/** FUNCTION WALKS OVER THE TABLE ROWS **/	applyRowsHover: function(rows) {		tableRows = $A(rows);		tableRows.each(function(row, index){			Event.observe(row, 'mouseover', function() { this.addClassName('over');    }, false);			Event.observe(row, 'mouseout' , function() { this.removeClassName('over'); }, false);		}.bind(this));	}}Event.observe(window, 'load', function() { var zebraTable = new zebraTables(); zebraTable.initialize; }, false);