Location: PHPKode > scripts > cellroll_lib > cellroll_lib/cellroll_lib.php
<?php
 
/*  	cellroll_lib by hide@address.com
	all rights reserved!
	you can use it for free, if you don't delete the copyright-notices!
*/

class Cellroll	{
	
	/* constructor
	   just outputs the js functions....
	   [ js-functions are tested and working fine with ie 5+ and Gecko1.1/20020721, NS 4x fails without js-error(s) ]
	*/
	function Cellroll()	{
		echo "<script type=\"text/javascript\"> \r\n";
		echo "<!-- \r\n";
		echo "// cellroll_lib by hide@address.com \r\n";
		echo "// all rights reserved! \r\n";
		echo "function tbgc(obj,col)	{ \r\n";
		echo "	obj.style.backgroundColor = col; \r\n";
		echo "} \r\n";
		echo "//--> \r\n";
		echo "</script> \r\n";
	}


	/* output the js-tags for a roll action
	   you may have color rolls for MouseOver, MouseOut, MouseDown
	   all params need hex-values or codenames for the choosen color
	   you can skip an event-handler by passing `NULL`
	*/
	function croll($over=NULL,$out=NULL,$down=NULL)	{
		$tmp = "";
		if($over)	$tmp .= " OnMouseOver=\"tbgc(this,'$over')\"";
		if($out)	$tmp .= " OnMouseOut=\"tbgc(this,'$out')\"";
		if($down)	$tmp .= " OnMouseDown=\"tbgc(this,'$down')\"";
		echo $tmp;
	}

} // end class Cellroll

?>
Return current item: cellroll_lib