Forum: Ruby on Rails how set background image inside <td > tag dynamically

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
79f80071bfe54a5e492b26fbf320f74b?d=identicon&s=25 Vijayendra Achar (vijayendra)
on 2007-01-29 15:51
how set background image inside <td > tag dynamically - plz help me
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-01-29 16:03
(Received via mailing list)
Vijayendra Achar wrote:

> how set background image inside <td > tag dynamically - plz help me

Statically, it's like style =
"background-image:url(/images/wiki/skyRamp.png)"

Dynamically, it might be page['td_id']['style'].backgroundImage =
"url(...)"

Someone should check my JavaScriptGenerator syntax, but that's where I
would start...

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
79f80071bfe54a5e492b26fbf320f74b?d=identicon&s=25 Vijayendra Achar (vijayendra)
on 2007-01-29 16:13
Phlip wrote:
> Vijayendra Achar wrote:
>
>> how set background image inside <td > tag dynamically - plz help me
>
> Statically, it's like style =
> "background-image:url(/images/wiki/skyRamp.png)"
>
> Dynamically, it might be page['td_id']['style'].backgroundImage =
> "url(...)"
>
> Someone should check my JavaScriptGenerator syntax, but that's where I
> would start...
>
> --
>   Phlip
>   http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!


if i wanted to code this insdie <%= %> how to code
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-01-29 16:26
(Received via mailing list)
Vijayendra Achar wrote:

> if i wanted to code this insdie <%= %> how to code

Oh, that kind of "dynamic"!

Here's my output:

<td colspan="2" style="background-image:url(/images/wiki/skyRamp.png)">

(I built that with Builder::XmlMarkup, not ERb. Don't try that until
you learn more programming!)

Now you can put the <%= %> anywhere in there that you like, replacing
as much or as little of the source as you need, so long as ERb can
read it and generate well-formed HTML.

To vary just the image itself, try this:

<td colspan="2" style="background-image:url(<%= get_my_image() %>)">

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
79f80071bfe54a5e492b26fbf320f74b?d=identicon&s=25 Vijayendra Achar (vijayendra)
on 2007-01-29 17:28
thanks

but its not working




Phlip wrote:
> Vijayendra Achar wrote:
>
>> if i wanted to code this insdie <%= %> how to code
>
> Oh, that kind of "dynamic"!
>
> Here's my output:
>
> <td colspan="2" style="background-image:url(/images/wiki/skyRamp.png)">
>
> (I built that with Builder::XmlMarkup, not ERb. Don't try that until
> you learn more programming!)
>
> Now you can put the <%= %> anywhere in there that you like, replacing
> as much or as little of the source as you need, so long as ERb can
> read it and generate well-formed HTML.
>
> To vary just the image itself, try this:
>
> <td colspan="2" style="background-image:url(<%= get_my_image() %>)">
>
> --
>   Phlip
>   http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-01-29 17:48
(Received via mailing list)
Vijayendra Achar wrote:

> thanks
>
> but its not working

Start a new thread with a new subject line, and post your code here.

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
This topic is locked and can not be replied to.