PDA

View Full Version : Changing Colors Using PHP & Javascript



bigperm
March 28th, 2002, 00:05
Ok... Here is my idea, let me know if it will work.

Say I have a link with a set background color, and I want the hover color to be a shade lighter than the background color. Is there a way to use PHP to subtract maybe 3 from each RGB value in a hex color code?

You would have to seperate #FFFFFF into # FF FF FF and then subtract hexidecimaly (is that a word?) each one by a certain number.

Like have

include "http://whatever.com/link.php?url=\"http://moviepoopshoot.com\"&color=\"#FF6633\"";

And have that return the javascript for a mouse over with the colors just a hair different than the one specified?

Can you even pass variable like that?

Does this make any sense to anyone?

MN-Carl
March 28th, 2002, 11:01
Hmmm ......

That would be ok ....

Nice idea ... but i'm sure its been done before ......

also the code is wrong




include "http://whatever.com/link.php?url=http://moviepoopshoot.com&color=#FF6633";

invalid
March 28th, 2002, 17:59
http://home.hetnet.nl/~zzhang/home_foot.html

take a look at that page... it uses sliders to change the bgcolor. I'm not sure if thats what your looking, but you might be able to base your code on that.