views:

91

answers:

2

i need to load an background image in css after the HTML things(text box ,hyperlinks) have been loaded ...

+1  A: 

Like this:

$(function() { 
    $('someElement').css('background', 'url("...")');
});
SLaks
I think he means load the image "in the background", not as a background image.
inkedmn
@inkedmn: Then he doesn't make any sense. All images are loaded in the background. (Unless he's asking to preload an image)
SLaks
A: 

In plain JavaScript:

<script type="text/javascript">
  function loadBackgroundImage() {
    document.body.style.backgroundImage="url(background.jpg)";      
  }
</script>

HTML:

<body onload="loadBackgroundImage();">

In jQuery:

<script type="text/javascript">
  $(document).ready(function() {
    $("body").css("background-image","url(background.jpg)");  
  });
</script>
Gert G