S
Stefan Mueller
With 'background-color' I can set the color of an input box. But how can I
set the color of the inner area of a checkbox?
Stefan
set the color of the inner area of a checkbox?
Stefan
With 'background-color' I can set the color of an input box. But how can I
set the color of the inner area of a checkbox?
you to do with styling form elements.
Does that mean that it's not possible to set the color of the area where the
check is located?
Not if it's in the mail.
Stefan said:Sorry, I'm not an English native speaker and therefore I don't understand
your answer. What are you talking about mail?
Is it possible to set the color of the area where the check of a checkbox is
located or is it not possible?
your answer. What are you talking about mail?
Sorry, I'm not an English native speaker and therefore I don't understand
your answer. What are you talking about mail?
Is it possible to set the color of the area where the check of a checkbox is
located or is it not possible?
Stefan said:With 'background-color' I can set the color of an input box. But how
can I set the color of the inner area of a checkbox?
Stefan
Nik said:You have your normal checkbox, unstyled. You use JavaScript to hide
it (so that it is still on the page but invisible) and use JavaScript
to add your replacement checkbox, which is just a boring old <img>. You
then use the onclick event of the image to switch between two
custom images, one for checked and one for unchecked. At the same
time you set the hidden checkbox to be checked or unchecked. When
the form is submitted it gets the value from your hidden checkbox. If the
user doesn't have Javascript enabled then they just get the
normal unstyled checkbox as a fallback.
It depends on the browser. Some browsers may allow you to, some
certainly don't.
Stefan said:I have a problem with your solution.
If you modify the line
<body onload="document.getElementById( 'check' ).style.display =
'none';"> of your code with
<body onload="document.getElementById( 'check' ).style.display =
'inline';">
then you'll see also the real checkbox.
If you click now on the colored checkbox (image) the real checkbox
gets also checked. But if you press now F5 (browser refresh) the real
checkbox remains checked whereas the colored checkbox gets cleared.
Therefore I have an inconsistency between the real and the colored
checkbox. If you press Shift + F5 then it works.
Does someone know how to fix this problem?
Stefan
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.