|Pathologically Eclectic Rubbish Lister
Selectively coloring a menu's item membersby hacker (Priest)
|on Aug 31, 2007 at 23:49 UTC
hacker has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to color a menu of items on an webpage, based on the item currently selected. I know the item chosen, based on $cgi->param('a'), so that part isn't a problem.
I've abstracted the logic into a small, standalone script that looks like this:
In my actual code, I have a dispatch table that looks like this:
I'm trying to selectively color the background of the item selected. What am I missing in my sample code above?
I'm only trying to colorize 4 of the 10 menu options, and only one should be colorized at a time. They're in my dispatch table in the production code (not an array like the sample test above; I created that to try to isolate the problem).
Is there a better way to do this?