Instance variables in Javascript param

How can I make this work ?

@div_id is an instance variable ?

TIA

nuubie wrote:

How can I make this work ?

@div_id is an instance variable ?

TIA

The @div_id needs to be encapsulated in <%= %> tags in order to be
parsed by ruby. i.e.

It is probably preferable to use the built-in rails helpers for this
though. Try:
<%= link_to_function ‘Link text’, visual_effect(:fade, @div_id) %>

-Sam

or use the tag helper:

<%= content_tag “a”, “link-text”, {:href => “#”, :onclick => “new
Effect.Fade(#{div_id})”} %>

another possible one:

link_to(“link-text”, {}, {:onclick => “new Effect.Fade(#{div_id})”} )

[did not test that…]

Wow, this is a great list.

Real-time response…

Thanks a lot, guys.
Peter E. wrote:

another possible one:

link_to(“link-text”, {}, {:onclick => “new Effect.Fade(#{div_id})”} )

[did not test that…]