I would like change background picture(a div) with javascript which i will require from database. Picture is baked into CSS. I wish to use JQuery.


.home_div { 
width: 958px; 
height: 350px; 
margin-bottom: 12px; 
background: url(../images/bg_home_div.png)

No JScript. However I use Jquery on other area of website.

You are able to change easily with javascript.

   <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            var image_url = "whatever comes from database";
            $('#image_div').css("background-image", "url('" + image_url + "')");


using jquery, you are able to:

$('body').css('background-image', 'images/myimage.jpg');

With javascript

var newimage = "your image link";
document.getElementById('yourDiv').style.backgroundImage = 'url(newimage)'