JQuery JavaScript Library

Ken Webb 2011-01-20T02:57:10Z

jQuery is "a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development". While a Xholon application (such as the Bestiary applet) is running inside a web page, you can paste in a jQuery script.

The following is a sample two step script. Step 1 adds a jQuery JavaScript function to the web page. Step 2 calls the new function with a numeric parameter that you can change. Just select the text of the two scripts one at a time, copy it to the clipboard, paste the text into the console panel on the Bestiary page, and press the Submit button. The applet needs to be actively running (unpaused) for this to work correctly.

<script implName="lang:BrowserJS:inline:"><![CDATA[
  // Step 1: add a script with JS content to a div in the HTML head
  $('div#divHeadOne').html("<script type='text/javascript'>function square(x) { return x*x; }</script>");
]]></script>
<script implName="lang:BrowserJS:inline:"><![CDATA[
  // Step 2: invoke the new JS content
  alert(square(2));
]]></script>

return to main page