[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] javascript
From: |
Per Bothner |
Subject: |
Re: [Qexo-general] javascript |
Date: |
Sun, 29 Feb 2004 08:35:37 -0800 |
User-agent: |
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7a) Gecko/20040218 |
Jun Yu wrote:
Thanks a lot. I know what the problem is.
If you want a '{' or '}' in a text child of a direct
element constructor, double it. Otherwise, it "escapes"
back to the XQuery expression level.
But no good idea to resolve it.
There are two simple examples about this, not my application.
1. test.xql
<html>
<body>
<script language="JavaScript">
document.write("<h2>hello, it is testing.</h2>");
for (i=1;i<10;i++){
document.write("i="+i+",");
}
</script>
</body>
</html>
Use:
<script language="JavaScript">
document.write("<h2>hello, it is testing.</h2>");
for (i=1;i<10;i++){{
document.write("i="+i+",");
}}
</script>
Or if you want to use XQuery to generate the JavaScript program:
<script language="JavaScript">
{'document.write("<h2>hello, it is testing.</h2>");
for (i=1;i<10;i++){
document.write("i="+i+",");
}'}
</script>
In this case the JavaScript block is inside a string literal.
--
--Per Bothner
address@hidden http://per.bothner.com/