Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2011
    Posts
    218
    Thanks
    4
    Thanked 1 Time in 1 Post

    Warrior (Level 8) Join Date: Jul 2011 Posts: 73 iTrader: (0) background color

    I want to rebuild a website, and I want to have a button that gives people the option of three background color choices. How can I do that?

  2. #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    951
    Thanks
    0
    Thanked 130 Times in 129 Posts
    Something like this?
    Code:
    var BGColors=["#000000","#FF0000","#0000FF"]
    var CurColor=0;
    function ToggleBGC(){
    CurColor=(CurColor+1)%3;
    document.style.backgroundColor=BGColors[CurColor];
    }


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •