Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] Physics "applets" in HTML5/JavaScript



There is an important library "jquery" and its close relative "jquery ui"
that make access to sliders and other such widgets essentially independent
of the many differences among browsers. These libraries are very widely
used. They are imported by GlowScript. Here's an example with buttons,
slider, and pulldown menu to run (click "Edit this program" to see the
code, which is browser-independent):

http://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/ButtonsSlidersMenus

For those unfamiliar with JavaScript, I'll comment that a lot of the
available documentation is aimed at web site designers, reflecting its main
historical use being to add dynamic elements to a web page. This kind of
documentation isn't very useful to us physicists. Here is what the
GlowScript Help says about learning JavaScript (and jquery); the book by
Flanagan has the great merit of starting with explaining how to use
JavaScript as a programming language, not as an appendage to html, but also
including chapters on connecting to a web page:

GlowScript uses JavaScript, a programming language that is widely used in
web browsers, though it has other uses as well. Despite its name,
JavaScript is not related to the Java programming language.

If you are new to programming, or just new to JavaScript, you'll find the
JavaScript tutorials at www.codecademy.com very helpful.

There are also helpful interactive tutorials on JavaScript available at
www.w3schools.com/js. However, these tutorials assume quite a lot of prior
knowledge about html and related web design issues.

An excellent textbook is *JavaScript: The Definitive Guide* by David
Flanagan (6th edition, 2011). This book assumes some prior programming
experience but has the advantage of being quite complete, including
extensive information on how to use JavaScript and jQuery to make dynamic
web pages.

Reference materials are found at developer.mozilla.org/en/JavaScript.

Bruce

On Mon, Mar 11, 2013 at 12:03 AM, Daniel V. Schroeder
<dschroeder@weber.edu>wrote:

The canvas element is definitely considered part of HTML5. When I said
"HTML5" I really meant "canvas"; the only other HTML5 feature I've used is
the slider control ("input type=range"), which I find extremely handy
though unfortunately it's not yet supported by Firefox or by several of the
mobile browsers.