hello everybody, i''m just trying to know this RoR better. And I have a question: - i have a <div> in my scaffold.css and it has a background image. I actually have 5 background pictures and i''d like to use one of them randomly. Do I have to move this div description in another .rb file (where i can do the random pick with ruby?) or is there any other way? i hope it made sence. thanks for your help, iM -- Posted via http://www.ruby-forum.com/.
Javascript to change the style of this div "onload"? - S imehesz wrote:> hello everybody, > > i''m just trying to know this RoR better. And I have a question: > > - i have a <div> in my scaffold.css and it has a background image. I > actually have 5 background pictures and i''d like to use one of them > randomly. Do I have to move this div description in another .rb file > (where i can do the random pick with ruby?) or is there any other way? > > i hope it made sence. > > thanks for your help, > iM-- Posted via http://www.ruby-forum.com/.
imehesz wrote:> hello everybody, > > i''m just trying to know this RoR better. And I have a question: > > - i have a <div> in my scaffold.css and it has a background image. I > actually have 5 background pictures and i''d like to use one of them > randomly. Do I have to move this div description in another .rb file > (where i can do the random pick with ruby?) or is there any other way? > > i hope it made sence. > > thanks for your help, > iM<div style="background-image: url(/images/<%= rand(5) %>.jpg"> </div> Every time you relaod the page "rand(5)" will yeild a different number from 0 - 4, resulting in a random displayed image. -- Posted via http://www.ruby-forum.com/.
thank you it helped! iM> > <div style="background-image: url(/images/<%= rand(5) %>.jpg"> > </div> > > Every time you relaod the page "rand(5)" will yeild a different number > from 0 - 4, resulting in a random displayed image.-- Posted via http://www.ruby-forum.com/.