Click to See Complete Forum and Search --> : complicated strings in js


skychum
07-28-2003, 04:04 AM
Is there any way to store complicated strings with javascript? Something that can take any string between delimiters, even </script> tags? Something like PHP's heredocs.

Thanks!

xataku_nakusute
07-28-2003, 04:09 AM
well...if you mean, how to store javascript scripts, you can take off the <script> and </script> tags and save the file as a .js file, upload it to your server, and in your head section, reference to it with something like:

<script src="..../url_path_to_your_js_file/js_file.js"></script>

(make sure not to put anything between the <script> and </script> tags

AdamGundry
07-28-2003, 04:54 AM
I don't believe Javascript has heredoc functionality, so you have to use a normal string and escape the quotes using backslashes, like this:

var str = "A string containging \"quoted\" text.";

Adam