Page 1 of 1
Background Colour on Checkboxes
Posted: Sun Oct 15, 2006 7:50 am
by phppage
I'm trying to set a background colour on a checkbox but does not seem to work on any browser. Just setting a background colour in CSS sheet the same you would for anything else. I am using the same class on other inputs such as text and works fine. Reading around the Internet there looks to be some issues with this. Would anyone know of any way round this problem.
Many Thanks
Posted: Sun Oct 15, 2006 5:45 pm
by JellyFish
opera appears to allow background color change on their chackboxes. However IE 6 seems to not work so good as you may already know.
I dont' know of any way to change the background color of a chackbox element on IE. Maybe you could take into consideration of making a chackbox duplicate with javascript.
Posted: Sun Oct 15, 2006 5:55 pm
by phppage
JellyFish wrote:Maybe you could take into consideration of making a chackbox duplicate with javascript.
Not a bad idea, many thanks for that.

Posted: Sun Oct 15, 2006 6:55 pm
by JellyFish
Go to:
http://htmledit.squarefree.com and type:
Code: Select all
<html>
<head>
<style>
#cbox {
background-color: #fff;
width: 13px;
height: 13px;
border: 1px solid #047;
}
</style>
<script>
function body_onload()
{
Checkbox = document.getElementById("cbox");
}
function checkbox_onclick()
{
(Checkbox.background) ? Checkbox.background = "" : Checkbox.background = "http://img208.imageshack.us/img208/674/checkmw8.png";
}
</script>
</head>
<body onload="body_onload()">
<table cellspacing="0" cellpadding="0" id="cbox" onclick="checkbox_onclick()"><tr><td></td></tr></table>
<br>
<input type="checkbox">
</body>
</html>
Just need some more work. 'Ope tat 'elps.
Posted: Mon Oct 16, 2006 1:25 am
by Luke
Posted: Mon Oct 16, 2006 2:32 pm
by phppage
Wow, thanks for those folks. Was going to go off and write my own last night. I'm glad I didn't.
The download links don't seem to work on this page goat. Do you know of any mirror sites at all?