Locale switcher with theme using css and javascript

General Add comments
SocialTwist Tell-a-Friend

I made small css based locale switcher with theme. You can see the demo here. In this example, common.css has generic style definations for page elements. gray.css has india locale and gray theme style definations. yellow.css has US locale and yellow theme style definations. Below 3 lines of javascript code will switch locale as well as theme.

<script>
function changeTheme(){
    var obj = document.getElementById("themeContainer"); 
    obj.className = (obj.className=='gray')?'yellow':'gray'; 
}
</script>

US locale - yellow themeIndia locale - gray theme

you can download this example here.

2 responses to “Locale switcher with theme using css and javascript”

  1. thor
    thor Says:
    this is good. how about the color? does it have to be codes? won't there be any conflict if I write what color I want?
  2. CF Mitrah
    CF Mitrah Says:
    @thor, I am just changing the classnames using javascript. you can define colors in gray.css or in yellow.css

Leave a Reply

*** Please do not post spam. All comments require moderation,
So it may take some time to post to this blog! ***



Powered by Mango Blog. Design and Icons by N.Design Studio