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
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    118
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Swap background image without refreshing?

    Hey everyone,

    I'm just trying to figure out if it is possible to swap the pages background image when a button is clicked without refreshing the page? I've looked around and can't really find anything helpful.

    Any tips or pointers in the right direction would be much appreciated

    Thanks

    YD
    Last edited by YourDirector; 03-20-2012 at 02:01 PM. Reason: Resolved

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    All you need is an onclick event handler on the button which calls a javascript function which then changes the background image css style for the <body>

    There's heaps of examples on the www on how to use javascript to change css styles.

  • Users who have thanked webdev1958 for this post:

    YourDirector (03-20-2012)

  • #3
    Regular Coder
    Join Date
    Jul 2011
    Posts
    118
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Fantastic, thank you for that. A simple and quick search for javascript CSS change gave me exactly what I needed. Thanks!

  • #4
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    glad you sorted it out


  •  

    Tags for this Thread

    Posting Permissions

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