locked
Dynamically Change Background Image RRS feed

  • Question

  • User-1365476174 posted

    I have set the background image of my master page using the following code:

    <body background="/images/image_name.gif">

    I want to be able to dynamically change the image using an AJAX call, i.e. I don't want a page refresh.  Is this possible?



    Tuesday, October 20, 2009 11:00 AM

Answers

  • User-1365476174 posted

    It's working - thanks!


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 20, 2009 12:36 PM

All replies

  • User-1360095595 posted

    I just did it with a bit of javascript.  Would that work for you?

    Tuesday, October 20, 2009 11:13 AM
  • User-1365476174 posted

    Sure, that would be a start.

    Tuesday, October 20, 2009 11:38 AM
  • User-1360095595 posted

    Something like this:

    <script type="text/javascript">
    	function changeBackgroudImage()
    	{
    		document.body.setAttribute('background', "/Images/YourImage2.gif");
    	}
    	
    </script>
    


     

    Tuesday, October 20, 2009 11:52 AM
  • User-1365476174 posted

    It's working - thanks!


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 20, 2009 12:36 PM