hi guys, i'm trying to change the backgroung-image of an object using a reguler js function that i wrote- this is the code, but for some reason , it doesn't work: tli.style.background="background-image: url('images/p.jpg') no-repeat"; Code (markup): tli is an object taht contain some <p>that i would like to change her background , but the code i wrote doesn't work- Can u help me?? thanx a lot progfrog
ok, in javascript, for doing css styles, for example, the "background-image" property, you must remove the hyphen and capitalize the second letter, like this, "backgroundImage". Next, javscript is an object oriented language, so you do objects and attributes. You need to make your code look like this. tli.style.backgroundImage = "url('images/p.jpg') no-repeat"; Code (markup): See, it will set the "background-image" property of object "tli" to "url('img... bla bla bla"
HI man, It doesn't work for me also.. can u try it your self and tell me what did u managed to do? thanx again, progfrog
yes, i did but is still doesn't work.. us there anything else that can make it work? sorry for posting to u a week later..