SpringFlowers AutumnMoon wrote:
[...]
>
> then the code generated is
>
>
> <script type="text/javascript">
>
> var s = "Bill Gates's dog said \"whoof whoof\" and \n
> ran away.";
>
> var t = "Bill Gates's dog said "whoof whoof" 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
[email protected]
--
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 [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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---