Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bg-color of a checkbox

0 views
Skip to first unread message

Frank Schniering

unread,
Dec 26, 2002, 9:36:56 AM12/26/02
to
Hello,

is there any way to change the background
color of a checkbox or a radio-button?
I do not talk about the color /around/ the checkbox
(that will be changed with the background-attribute)
but the color *inside* the checkbox...


THX in advance...


...Frank


omicron

unread,
Dec 28, 2002, 2:16:18 PM12/28/02
to
On Thu, 26 Dec 2002 14:36:56 -0000, "Frank Schniering"
<ms_new...@schniering.de> wrote:

>Hello,
>
>is there any way to change the background
>color of a checkbox or a radio-button?
>I do not talk about the color /around/ the checkbox
>(that will be changed with the background-attribute)
>but the color *inside* the checkbox...
>

Try this:

<html>
<head>
<script type="text/javascript">
function changeColor(color)
{
myForm.elements[0].style.background=color
}
</script>
</head>
<body>

<p>This example demonstrates how to change the background color of a
checkbox.</p>

<p>Mouse over the three colored table cells, and the background color
will change:</p>

<table width="100%"><tr>
<td bgcolor="red" onmouseover="changeColor('red')"> </td>
<td bgcolor="blue" onmouseover="changeColor('blue')"> </td>
<td bgcolor="green" onmouseover="changeColor('green')"> </td>
</tr></table>

<form name="myForm">
Mouse over the colors <input checked type="checkbox">
</form>

</body>
</html>
-----------------------------------------------------------------
And this:

<html>
<head>
<script type="text/javascript">
function changeColor(color)
{
myForm.elements[0].style.background=color
}
</script>
</head>
<body>

<p>This example demonstrates how to change the background color of a
radio button.</p>

<p>Mouse over the three colored table cells, and the background color
will change:</p>

<table width="100%"><tr>
<td bgcolor="red" onmouseover="changeColor('red')"> </td>
<td bgcolor="blue" onmouseover="changeColor('blue')"> </td>
<td bgcolor="green" onmouseover="changeColor('green')"> </td>
</tr></table>

<form name="myForm">
Mouse over the colors <input checked type="radio">
</form>

</body>
</html>
----------------------------------------------------

Frank Schniering

unread,
Dec 29, 2002, 6:36:32 AM12/29/02
to
omicron wrote:

> Try this:
>
> <html>
> <head>
> <script type="text/javascript">
> function changeColor(color)
> {
> myForm.elements[0].style.background=color
> }
> </script>
> </head>

> [...]


Hello Omicon,

this will change the bg-color "around" the checkbox.
I悲 like to know, if there is a way to change the color
"inside" the checkbox/radio button...

Thanks anyway...

...Frank


omicron

unread,
Dec 29, 2002, 2:45:13 PM12/29/02
to
On Sun, 29 Dec 2002 11:36:32 -0000, "Frank Schniering"
<ms_new...@schniering.de> wrote:

>omicron wrote:
>
>> Try this:
>>
>> <html>

>Hello Omicon,


>
>this will change the bg-color "around" the checkbox.

>I?d like to know, if there is a way to change the color


>"inside" the checkbox/radio button...
>
>Thanks anyway...

Hmm..yep...right. I see your point. Ok...sorry...I don't know of any
method to do that but that certainly doesn't mean there isn't some way
to achieve the desired effect. Keep at it!

Jacob Dvir

unread,
Dec 31, 2002, 8:46:34 AM12/31/02
to
U can use a simple image that replaces itself.

that way you can put any kind of image (color & border)
and attach to it a onclick event to switch between '1'
or '0'

0 new messages