Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6

Thread: BG Changer?

  1. #1
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default BG Changer?

    Hello,

    How do I make a background changer?

    Where a user can select a background and it changes without refreshing.

    I want them to click say a 50px*50px image and the background change to that image (the image will be tiled).

    Thanks
    Tom
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  2. #2
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    Here you go This is the script that I wrote for my site. Put this in the head:

    Code:
    <script type="text/javascript">
    function setBackgroundImage(url) {
    		document.body.style.backgroundImage = 'url(' + url + ')';
    }
    </script>
    Then you can call it pretty easily. For example, if you want to change the background colour when you click a specific image:

    Code:
    <img src="whatever.jpg" alt="This will change the bg to bg.gif" onClick="setBackgroundImage('bg.gif')" />
    I have different version on my site that changes the background, and then loads a PHP page which saves your choice into a cookie.



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  3. #3
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    i dont understand how to use it lol I know whwere to put it all etc... But:

    1. Will it let me set the Background IMAGE to the Image thats clicked.
    2. How do I add images
    3. what do I change where
    4. I am blonde so thats why i am dumb
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  4. #4
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    Just put the Javascript bit into the head of your page. Then, for example, if the image was called "animage.gif" and you wanted to change the background to itself when you clicked it, you would use this code for the image:

    Code:
    <img src="animage.gif" alt="An image" onclick="setBackgroundImage('animage.gif')" />



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  5. #5
    Ryan. Guest

    Default

    . I wanted this a while ago. Thanks tim +rep

    edit: need to spread

  6. #6
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Thanks alot you two! It worked perfectly +REP if i can...
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

Posting Permissions

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