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 7 of 7
  1. #1
    Topps Guest

    Default Changing a webpages background by clicking a link/image?

    If you know what I mean by the title, I need something where you click a link and it changes the background to a different image?

  2. #2
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default

    yeah.
    Code:
    <script language="JavaScript">
    <!--
    
    var backImage = new Array(); // don't change this
    
    // Enter the image filenames you wish to use.
    // Follow the pattern to use more images.  The
    // number in the brackets [] is the number you
    // will use in the function call to pick each
    // image.
    
    // Note how backImage[3] = "" -- which would
    // set the page to *no* background image.
    
    backImage[0] = "bg1.gif";
    backImage[1] = "bg2.gif";
    backImage[2] = "bg3.gif";
    backImage[3] = "";
    
    // Do not edit below this line.
    //-----------------------------
    
    function changeBGImage(whichImage){
    if (document.body){
    document.body.background = backImage[whichImage];
    }
    }
    
    //-->
    </script>
    </textarea>
    </form>              
                  </td>
                </tr>
    <a href="javascript:changeBGImage(0)">Change 1</a>
    <a href="javascript:changeBGImage(1)">Change 2</a>
    <a href="javascript:changeBGImage(2)">Change 3</a>
    <a href="javascript:changeBGImage(3)">No Background</a>
    working example:
    www.habbo-club.co.uk/background.htm
    Last edited by Swearwolf; 22-08-2007 at 06:35 PM.
    no

  3. #3
    Topps Guest

    Default

    Quote Originally Posted by estranged View Post
    yeah.
    Code:
    <script language="JavaScript">
    <!--
    
    var backImage = new Array(); // don't change this
    
    // Enter the image filenames you wish to use.
    // Follow the pattern to use more images.  The
    // number in the brackets [] is the number you
    // will use in the function call to pick each
    // image.
    
    // Note how backImage[3] = "" -- which would
    // set the page to *no* background image.
    
    backImage[0] = "bg1.gif";
    backImage[1] = "bg2.gif";
    backImage[2] = "bg3.gif";
    backImage[3] = "";
    
    // Do not edit below this line.
    //-----------------------------
    
    function changeBGImage(whichImage){
    if (document.body){
    document.body.background = backImage[whichImage];
    }
    }
    
    //-->
    </script>
    </textarea>
    </form>              
                  </td>
                </tr>
    <a href="javascript:changeBGImage(0)">Change 1</a>
    <a href="javascript:changeBGImage(1)">Change 2</a>
    <a href="javascript:changeBGImage(2)">Change 3</a>
    <a href="javascript:changeBGImage(3)">No Background</a>
    working example:
    www.habbo-club.co.uk/background.htm
    Thanks a billion and over, you're amazing! :eusa_danc

  4. #4
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default

    you're more than welcome
    no

  5. #5
    Topps Guest

    Default

    One last question, can I put the links in an iframe and put the iframe on a page and it changes the page with the iframe on, I tried target="_parent" but it didn't work...

  6. #6
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default

    should be able to
    ill have a look

    *edit*

    i cant seem to figure out how you would go about doing this because they are javascript links, they cant open in a new frame correctly...
    all i can suggest is if you have a coded layout etc you could create an extra cell near the navigation or w.e you want the links to be and put all the code on same page, all i can think of
    Last edited by Swearwolf; 22-08-2007 at 09:42 PM.
    no

  7. #7
    Topps Guest

    Default

    What about an include? Would that make it open on the main page its changing?

    Edit that, I need a scroll bar to be there.

    OK, it's like a Habbo Home Script, but you click BackGrounds and a box pops up in a frame and you choose the background you'd like to change it to.
    Last edited by Topps; 22-08-2007 at 09:53 PM.

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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