2009/2/3 Eric <lefauv...@gmail.com>: > > Hi, > > I have a div and I'd like to set its background image style using the > "object" format. > > I tried without success the following things: > > $('mydiv').setStyle({'backgroundImage':'wait.gif'}); > $('mydiv').setStyle({'backgroundImage':'url(wait.gif)'}); > $('mydiv').setStyle({'background-image':'wait.gif'}); > $('mydiv').setStyle({'background-image':'url(wait.gif)'}); > > It doesn't rise any error but doesn't set the background either. > > The only working way I found until now is using the string format > parameter. > This one works: > $('mydiv').setStyle('background-image:url(wait.gif);'}); > > I really would like to use the object form, which is working for other > style properties on the very same object. > (ex: $('mydiv').setStyle({'left':xpos+'px','top':ypos+'px'}); ) > > Am I missing something here? > > Thanks for any hint. > > Eric > > >
The attribute name should not be in quotes ... $(element).setStyle({ backgroundColor: '#900', fontSize: '12px' }); so ... $('mydiv').setStyle({backgroundImage:"url(waitgif)"}); -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---