[REBOL] Re: printing javascript tags
From: kevin:sunshinecable at: 5-Feb-2001 17:15
On Mon, 5 Feb 2001, Terry Brownell wrote:
> How do you form and print the following javascript....
>
> <SCRIPT>
> document.cookie = 'CookiesEnabled=1';
> if (document.cookie == ' ') {
> {document.location.href='http://www.yourdom.com';}
>
> </SCRIPT>
>
> ...seeing that it contains semi-colons, single quotes and curly braces?
Terry,
Matching number of left and right braces should do it.
As the Core User Guide says, "multi-line strings are enclosed in
brackets". What it doesn't say is that if you have embedded braces
*inside* your string, you need to have a matching number of opens and
closes.
I think you've got one too many open braces. I added the extra close
brace above </SCRIPT> to make it work:
REBOL []
a: { <SCRIPT>
document.cookie = 'CookiesEnabled=1';
if (document.cookie == ' ') {
{document.location.href='http://www.yourdom.com';}
}
</SCRIPT>}
print a
Cheers,
Kev