shivboy
11-05-2006, 06:25 PM
Hi,
I've been trying to change the background image of a layer using JS, but in vain. The code that I am using is as follows:
CSS
<style>
.bannerDiv {top: 5px; left: 2px; position: absolute;}
</style>
JavaScript
function init()
{
document.getElementById('bannerDiv').style.backgroundImage = 'url("abc.jpg")';
}
HTML
<body onload="init()">
<div id="bannerDiv" class="bannerDiv"></div>
</body>
There is no error generated, but the image does not show in the layer also. Where am I going wrong? Please help.
Peace,
Shivboy
I've been trying to change the background image of a layer using JS, but in vain. The code that I am using is as follows:
CSS
<style>
.bannerDiv {top: 5px; left: 2px; position: absolute;}
</style>
JavaScript
function init()
{
document.getElementById('bannerDiv').style.backgroundImage = 'url("abc.jpg")';
}
HTML
<body onload="init()">
<div id="bannerDiv" class="bannerDiv"></div>
</body>
There is no error generated, but the image does not show in the layer also. Where am I going wrong? Please help.
Peace,
Shivboy