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 4 of 4

Thread: Web background

  1. #1
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Web background

    I would like to know the code for changing the background on my site.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,662
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    You mean the background color?
    You can do that with JavaScript. And you would include that in a link I guess:
    Code:
    <a href="#" onclick="document.bgColor='green'; return flase;">link</a>

  • #3
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Quote Originally Posted by VIPStephan
    You mean the background color?
    You can do that with JavaScript. And you would include that in a link I guess:
    Code:
    <a href="#" onclick="document.bgColor='green'; return flase;">link</a>
    bgColor? Were you born in a barn?

    At least give the guy something from this century (and typed correctly).



    - - -

    OP, you can use CSS to set a different default background colour for your page(s).

    http://www.w3schools.com/css/default.asp
    http://www.w3schools.com/css/css_ref...asp#background
    http://www.w3schools.com/css/css_background.asp


    If you want to dynamically change it from one colour to another, then you can use javascript…

    Code:
    … onclick="document.getElementsByTagName('body')[0].style.backgroundColor='green'; return false;"…
    For something more permanent, take a look at javascript styleswitchers and php styleswitchers
    Last edited by Bill Posters; 07-21-2006 at 05:51 PM.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,662
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    Well. I don't know... I found this somewhere some time ago and it worked but I actually never used it. I'm not a big JavaScript nut. Sorry for giving a wrong advice.


  •  

    Posting Permissions

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