View Full Version : Setting Background color of a button?
03-17-2004, 09:19 PM
In HTML it's setup like:
<BUTTON NAME="BTN-GENERAL" OnClick="showgeneral();" STYLE="background:yellow">General</BUTTON>
I want to change the background color in my
function. I've tried using:
but get an error....
I've tried using style.backgroundcolor="grey", but it doesn't
What is the sub-property name to set the background color?
03-17-2004, 09:38 PM
so, the problem isn't the coding, it's "grey"
Apparantly, grey isn't a known color.
I'll have to figure out the # code for grey.
03-17-2004, 09:40 PM
Your problem was that "grey" needed to be spelled "gray". Works fine in Mozilla, but of course IE doesn't like it when you don't follow their rules. Dictionary.com says that it can be spelled either way, and here's wikipedia's view:
03-17-2004, 09:44 PM
OOOOOO. It's gray instead of grey.
Well, it also worked with silver! Hard to screw that spelling up
03-17-2004, 10:56 PM
its alot easier(in my point of view) to just go like:
in my opinion
03-18-2004, 02:20 AM
ggallen, the # value of a color is simple to figure out :)
it's basically specifying how much of red, green and blue the color should containt (for a maximum of 255)
But the values are given in hexadecimal.
the two first numbers are for red, the two middle numbers are for green and the two last numbers are for blue.
or in decimal:
If you don't want to bother with hexadecimal, you could also use the rgb technique.
Does that help at all?
Oh and for gray, as long as there is the same amount of red, green and blue, it will give gray.
#DDDDDD, #444444, #5F5F5F are all grays.
same as rgb(221,221,221), rgb(68,68,68) and rgb(95,95,95) respectivly.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.