Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Radio button style

Posted on 2010-11-16
7
Medium Priority
?
1,353 Views
Last Modified: 2012-05-10
Hello All,

I am trying to figure out if there is any way I can change the default green circle of the radio button with purple color?

Please can someone advise?

Thanks
0
Comment
Question by:charlie324
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Expert Comment

by:Mestika
ID: 34143129
Hi,

if you are using a Windows PC with default desktop / color settings, the default radiobutton color is a blue dot, not green.

But nevertheless, the radiobutton can't be styled in CSS as such. You will need to use a combination of CSS and JavaScript to customize your radiobuttons.

Please let me know if that's the case or if I have misunderstood your question.

- Mestika
0
 
LVL 6

Author Comment

by:charlie324
ID: 34143158
Hi Mestika
Thanks for your input, yes I am on Windows PC using FF, please see the screen shot attached, its showing in green color.
Yes, I want to apply #554061to the inner circle of the radio button, please can you advice how can I go about doing this?
Your help/suggestion/advise would greatly be appreciated.
Thank you
C
radio.PNG
0
 
LVL 3

Expert Comment

by:Mestika
ID: 34143216
Of yes of cause I forgot that Windows XP with FF showed them in green :-)

About your radiobuttons, you will have to create an image for a radiobutton active and one for a radiobutton inactive.

I could explaine the entire code with CSS and JS to you but I think that you would be more comfortable with some tutorials, so please look at these two pages:

http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/example/
http://www.maratz.com/blog/archives/2006/06/11/fancy-checkboxes-and-radio-buttons/

They both explain the styling of the radio / checkboxes and the first page shows how you can do it with only one image containing both an active and inactive radiobutton where the other page has a image for each type of radiobutton.

If you only want to keep the original style but change the color, it should be a fairly easy task just to Photoshop and colorize the green color into purple.

Please let me know if you have any further questions

- Mestika
0
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
LVL 6

Author Comment

by:charlie324
ID: 34147945
Hi Mestika
I did try to follow from the links above but did not have no luck on this yet ... please can you help in making one?
thank you
0
 
LVL 6

Expert Comment

by:TheQuietShadow
ID: 34148468
Call me silly, but couldn't you just create two images... One for selected and one for unselected and use javascript to change them? You could even use a third image for highlighting the radio button on mouseover. It would be much more customizable this way.
0
 
LVL 3

Accepted Solution

by:
Mestika earned 800 total points
ID: 34148999
Hey Charlie,

You have to create two images which is called: radio-off.png and radio-on.png

just put them in the same directory as the HTML file. Every CSS and JavaScript is within the HTML so the only thing you have to do is the two images.

I've created an zip archive with the index.htm and the two images so you can test it. Get it here:

http://www.box.net/shared/go92l4yti5
0
 
LVL 6

Assisted Solution

by:TheQuietShadow
TheQuietShadow earned 200 total points
ID: 34149030
I am including a sample that I know works in FireFox, but I don't know if it works in IE. You may have to tweek it to work in IE and will probably want to create your own images.

<html>
<head>
<title>Your first selection&nbsp; Your secon</title>
<script type="text/javascript">
var radio = 0;
function click(id) {
      if (id == "rb0")
      {
            document.getElementById("rb0").setAttribute("src", "Radio%20Button/on.png");
            radio = 0;
            document.getElementById("rb1").setAttribute("src", "Radio%20Button/off.png");
      }
      else
      {
            document.getElementById("rb1").setAttribute("src", "Radio%20Button/on.png");
            radio = 1;
            document.getElementById("rb0").setAttribute("src", "Radio%20Button/off.png");
      }
}
</script>
</head>

<body>
<span onclick="click('rb0');" style="cursor:pointer"><img id="rb0" src="Radio%20Button/off.png" alt="" height="22px" width="22px" style="position:relative;top:4px;" />
Your first selection</span>
<br />
<span onclick="click('rb1');" style="cursor:pointer"><img id="rb1" src="Radio%20Button/on.png" alt="" height="22px" width="22px" style="position:relative;top:4px;" onclick="click('rb1');" />
Your second selection</span>
</body>
</html>
 on off
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question