Greeting all, can anyone spot my error? i can hv my image display but the image is not fix while i scroll <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html class="sIFR-hasFlash"><head> </head><body id="product"> dddddd<br> ... my content... dddddd<br> <script language="JavaScript"> <!-- newImage = "url(http://localhost/bg2.jpg)"; document.getElementById('product').style.backgroundImage = newImage; document.getElementById('product').backgroundAttachment="fixed"; //--> </script> </body></html> HTML:
erm. this works: document.body.style.backgroundImage = "url(http://forums.digitalpoint.com/image.php?u=126037&dateline=1201615683)"; document.body.style.backgroundAttachment = "fixed"; Code (javascript): you are missing .style. on your second line. working test: http://www.jsfiddle.net/bsXNU/1/