|
From: <pm_...@us...> - 2011-06-08 08:55:24
|
Revision: 4394
http://mxquery.svn.sourceforge.net/mxquery/?rev=4394&view=rev
Author: pm_fischer
Date: 2011-06-08 08:55:18 +0000 (Wed, 08 Jun 2011)
Log Message:
-----------
use new event handler example
Added Paths:
-----------
trunk/MXQuery/xqib_samples/EventHandlers.html
Removed Paths:
-------------
trunk/MXQuery/xqib_samples/removeEventListener.html
Added: trunk/MXQuery/xqib_samples/EventHandlers.html
===================================================================
--- trunk/MXQuery/xqib_samples/EventHandlers.html (rev 0)
+++ trunk/MXQuery/xqib_samples/EventHandlers.html 2011-06-08 08:55:18 UTC (rev 4394)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>XQIB: Sample page</title>
+ <meta charset="UTF-8"/>
+ <link href="style.css" rel="stylesheet" type="text/css">
+ <script type="text/javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
+ <script type="application/xquery">
+
+ declare updating function local:named-handler($loc, $evt) {
+ insert node <b>named</b> as last into b:dom()//body
+ };
+
+ (b:addEventListener(b:dom()//input[@value="Add named"], "onclick",
+ function($loc,$evt){b:addEventListener((b:dom()//p)[1]/input[@type="button"], "onclick",local:named-handler#2)}),
+ b:addEventListener(b:dom()//input[@value="Remove named"], "onclick",
+ function($loc,$evt){b:removeEventListener((b:dom()//p)[1]/input[@type="button"], "onclick",local:named-handler#2)}),
+ b:addEventListener(b:dom()//input[@value="Add anonymous"], "onclick",
+ function($loc,$evt){b:addEventListener((b:dom()//p)[1]/input[@type="button"], "onclick",
+ %updating function($loc,$evt){insert node <b>anonymous</b> as last into b:dom()//body})}),
+ b:addEventListener(b:dom()//input[@value="Remove anonymous"], "onclick",
+ function($loc,$evt){b:removeAnonymousEventListeners((b:dom()//p)[1]/input[@type="button"], "onclick")})
+
+
+ )
+
+ </script>
+ </head>
+ <body>
+ <a href="index.html"><< Index</a>
+ <h1>Add/Remove Event Listeners</h1>
+ <div><a href="EventHandlers.html">Page</a> | <a href="EventHandlers_source.html">Source</a></div>
+ <p>
+ <input type="button" value="Click for events"/>
+ </p><p>
+ <input type="button" value="Add named"/>
+ <input type="button" value="Add anonymous"/>
+ <input type="button" value="Remove named"/>
+ <input type="button" value="Remove anonymous"/>
+ </p>
+ </body>
+</html>
Deleted: trunk/MXQuery/xqib_samples/removeEventListener.html
===================================================================
--- trunk/MXQuery/xqib_samples/removeEventListener.html 2011-06-08 08:54:35 UTC (rev 4393)
+++ trunk/MXQuery/xqib_samples/removeEventListener.html 2011-06-08 08:55:18 UTC (rev 4394)
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
-
- <head>
- <title>MXQuery JS Demo</title>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-
- <link type="text/css" rel="stylesheet" href="MXQueryJS.css"></link>
- <script type="text/javascript" language="javascript" src="mxqueryjs/mxqueryjs.nocache.js"></script>
- </head>
-
- <body>
-
- <!-- OPTIONAL: include this if you want history support -->
- <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
-
- <!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
- <noscript>
- <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
- Your web browser must have JavaScript enabled
- in order for this application to display correctly.
- </div>
- </noscript>
-
- <script type="application/xquery">
- declare sequential function local:listener($loc, $evtObj) {
-
- b:removeEventListener($loc, "onclick", local:listener#2),
- b:alert($loc);
-
- };
- for $d in b:dom()//div
- return b:addEventListener
- ($d, "onclick", "local:listener")
-
- </script>
-
- <h1>This sample will fire once for each of {Foo, Bar}</h1>
-
- <table align="center">
- <tr>
- <td id="nameFieldContainer"></td>
- <td id="sendButtonContainer"></td>
- </tr>
- <tr>
- <td colspan="2" style="color:red;" id="errorLabelContainer"></td>
- </tr>
- </table>
-
- <div id="paragraph1" style="font-size: 20pt;">Foo</div>
- <div id="paragraph2" style="font-size: 20pt;">Bar</div>
- <p id="someid">This is a pre-alpha version, translated from MXQuery 0.7.0 to Javascript using Google Web Toolkit. Expect bugs!</p>
- </body>
-</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|