Link to an external sheet and use classes. I've never had a problem  
doing it that way. It's kind of frowned upon to use inline styles.

/* styles.css */
element.regular     { background:url(images/image_one.png) no-repeat; }
element.alternate  { background:url(images/image_two.png) no-repeat; }

Then with rjs, just remove the regular class name and add the  
alternate or you can just add !important to the element.alternate  
style declaration.

Does that make sense?

On Oct 31, 2007, at 8:52 PM, Elliott Blatt wrote:

>
> Let's see who's got the best cross-browser chops!
>
>
> Here's my problem:
>
>
> #OBJECTIVE : change the background image of a div and have it work  
> in IE
> 6/7 and the real browsers.
>
> #HTML:
>
> <div id="my-div"
> style="background:url('http://www.foo.com/image_one.png'">
> ...
> </div>
>
> At this point, my background image (image_one.png) is visable in all
> three broswers. Upon an AJAX request, I'd like to update the  
> background
> to 'image_two.png'.  To accomplish this, I use RJS.
>
> #RJS:
>
> page['my-div'].setStyle(:background=>url('http://www.foo.com/ 
> image_two.png')
> ")
>
> #RESULTS:
> This works in firefox, but not in IE (v6, SP2), or Safari.
>
>
> #QUESTIONS:
>
> 1. Is my RJS technique correct?  Is there a more idiomatic/correct
> technique?
> 2. The seems like this a rather common programming objective, and  
> there
> should be a straight-forward solution.  Are other people doing this?
> 3. My cross-brower knowledge is not that great, but I'd love to find a
> good discussion of this topic, if someone knows of one.
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Deploying Rails" 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-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to