The below code snippet works.Cheers...
$(element).setStyle({
    'background: 'url(' + imgSrc + ') no-repeat'
  });

The one thing I learnt from this is to treat javascript more as a
scripting language and less as a programing language.

On Jan 4, 2:31 pm, RobG <[EMAIL PROTECTED]> wrote:
> On Jan 3, 11:27 pm, yash <[EMAIL PROTECTED]> wrote:
>
> > $(element).setStyle({
> >   background: 'url(/image.gif) no-repeat'       /* Myproblem:
> > background: 'someVariable' */
>
> > });
>
> > The above code snippet assigns the value 'url(image.gif) no-repeat' to
> > the property 'background'. I have a situation where in i am getting
> > the value i.e image URL from the back-end dynamically and i am able to
> > store it in a variable say 'someVariable'. Now what is the syntax I
> > should follow to assign 'someVariable' to background. Please help.
>
> Just assign it:
>
>   element.style.background = 'url(' + imgSrc + ') no-repeat';
>
> or if you really want to use setStyle:
>
>   $(element).setStyle({
>     'background': 'url(' + imgSrc + ') no-repeat'
>   });
>
> <URL:http://www.prototypejs.org/api/element/setStyle>
>
> --
> Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to