Rick Hurst Web Developer in Bristol, UK

Menu

setting css backround image style using javascript

this one stumped me for a while – the trick is to remove the hypen e.g:-

for background-image, use backgroundImage:-


myobj = document.getElementById("myObjId")
myobj.style.backgroundImage='url(/myimage.gif')';
Posted in Uncategorised