As a better way of doing this: Create a CSS class and change it with JS, this way you will have a better separation of logics/behavior (JS) and style (CSS).
-- Fábio Miranda Costa frontend@timehome Globo.com *github:* fabiomcosta *twitter:* @fabiomiranda *ramal:* 6476 2011/10/2 Philip Thompson <philthath...@gmail.com> > It should be: > background-image:url('button unclicked2.jpg'); > > instead of: > background-image:url(button%20unclicked2.jpg); > > AND with that URL you provided, it's saying that the image is in the same > directory as the css. So if it's not, you will need to update the actual url > relative to the css file. E.g., if your setup is like so... > > /css/styles.css > /images/button unclicked2.jpg > > then your css should look like: > background-image('../images/button unclicked2.jpg'); > > And as Oskar said, narrow down the jsfiddle with the actual problem you're > having, not the whole page. > > ~Philip > > > > 2011/10/1 Oskar Krawczyk <oskar.krawc...@gmail.com> > >> Ouch. Totally not how you use JsFiddle. >> >> Ok: >> >> 1. Input only the HTML and JS code that we should be looking at - not the >> whole document or the full class >> 2. The JS box accepts JS only, not HTML >> 3. Pick a framework from the dropdown on the left >> 4. Paste back a link to the code that actually works >> >> >> >> On Oct 1, 2011, at 3:33 PM, verymeang...@yahoo.com wrote: >> >> >> >> On 10月1日, 下午7時44分, Oskar Krawczyk <oskar.krawc...@gmail.com> wrote: >> >> Put it inhttp://jsfiddle.netand paste back a link. >> >> >> On Oct 1, 2011, at 10:13 AM, verymeang...@yahoo.com wrote: >> >> >> >> >> I have a fairly simple code: >> >> >> $('homeButtonImage').setStyle('background-image', 'url("button >> >> %20clicked2.jpg")'); >> >> >> referring to the <th> in the following <table> >> >> >> <table> >> >> <tr> >> >> <th></th><th id="homeButtonImage" class="button"><a >> >> id="homeButton" href="#">關於我們</a></th> >> >> <th></th><th id="secondPageButtonImage" class="button"><a >> >> id="secondPageButton" href="#">Second Page</a></th> >> >> <th></th><th id="thirdPageButtonImage" class="button"><a >> >> id="thirdPageButton" href="#">Third Page</a></th> >> >> <th></th><th id="fourthPageButtonImage" class="button"><a >> >> id="fourthPageButton" href="#">Fourth Page</a></th> >> >> <th></th><th id="fifthPageButtonImage" class="button"><a >> >> id="fifthPageButton" href="#">Fifth Page</a></th> >> >> </tr> >> >> </table> >> >> >> But the background image does not get reset. What is wrong? >> >> >> Thanks!- 隱藏被引用文字 - >> >> >> - 顯示被引用文字 - >> >> >> http://jsfiddle.net/BoPoMoFo/m4a3X/1/ >> >> Can you access it? >> >> Thanks! >> >> >> > > > -- > http://lonestarlightandsound.com/ >