-1

XQuery ファイルに HTML ボタンを作成しました。ファイルをクリックしたときに、ファイルの XQuery 関数を呼び出す方法を知りたいだけですか?

xquery version "1.0";
declare option exist:serialize "method=xhtml media-type=text/html";
declare function local:fn($str as xs:string) as xs:string
{
   ...
};

<html>
...
<input type="submit" onclick=" ? "/>
</html>

私は試した :

<input type="submit" value="Search" onclick="{local:fn()}"/>

しかし、うまくいきませんでした。

4

1 に答える 1

1

http://www.xqib.org/js/OnClickEvent.htmlで例を見つけることができます。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>   
    <title>XQIB: Sample page</title>
    <meta charset="UTF-8"/>
    <script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
    <script type="application/xquery">
      declare sequential function local:listener($loc, $evtObj) {
        b:alert("Hello, World")
      };

      b:addEventListener
        (b:dom()//input[@id="myButton"], "onclick", local:listener#2)
    </script>
  </head>
  <body>
    <h1>Onclick Event</h1>
    <input id="myButton" type="button" value="Click me"/>
  </body>
</html>
于 2012-12-24T11:11:57.420 に答える