[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] javascript
From: |
Jun Yu |
Subject: |
Re: [Qexo-general] javascript |
Date: |
Sun, 29 Feb 2004 12:31:28 +0100 (MET) |
Thanks a lot. I know what the problem is. 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>
I got the error message:
test.xql:5:12: missing NameSpec
test.xql:6:22: node test when focus is undefined
test.xql:6:27: missing '}' or ','
test.xql:7:1: missing expression
2. test3.xql
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function square(number) {
return number*number
}
</SCRIPT>
</head>
<body>
<SCRIPT>
document.write("The function returned ", square(5), ".")
</SCRIPT>
</body>
</html>
The error message is:
test3.xql:5:8: node test when focus is undefined
test3.xql:5:8: missing '}' or ','
test3.xql:5:15: node test when focus is undefined
test3.xql:5:15: missing '}' or ','
test3.xql:6:1: missing expression
Especially the second example, perhaps I can define a function which
follows XQuery grammer outside the javascript code-block, and then
call it in another javascript code-block.
In my application, I want to make a tree-like menu which is always visible
in my HTML pages. I am using two frames. One is the menu, another is
for the contents. That is why I need javascript.
Thanks for any suggestion.
best regards,
Jun Yu
On Sat, 28 Feb 2004, Per Bothner wrote:
> Jun Yu wrote:
>
> > But I found that, the self-defined functions and variables within the
> > javascript code-block do not work.
> > The system always prompts something like:
> > main.xql:8:9: node test when focus is undefined
> > main.xql:8:17: missing '}' or ','
>
> Of XQuery knows nothing of JavaScript, but there is no reason
> you can't embed JavaScript as long as you follow XQuery syntax.
> But you need to show us a more specific example.
> --
> --Per Bothner
> address@hidden http://per.bothner.com/
>