SpringFlowers AutumnMoon wrote:
[...]
> 
> then the code generated is
> 
> 
> <script type="text/javascript">
> 
>   var s = &quot;Bill Gates's dog said \&quot;whoof whoof\&quot; and \n 
> ran away.&quot;;
> 
>   var t = "Bill Gates's dog said &quot;whoof whoof&quot; and \n ran 
> away.";
> 
> </script>

Sorry, I misunderstood what you were trying to do.  If you are putting 
dynamically generated JavaScript in an HTML file, wrap the script in a 
CDATA section and don't HTML-escape it

However, putting JS in HTML files is a bad idea for lots of reasons, and 
you should never need to do so.  Better to use an external JS file that 
contains lines like
var s = document.getElementById('s').innerHTML

and then have your view contain

<div id='s'><%=h my_string%></div>

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to