Lezione 6: Supplement

A supplement for non-computer scientists reading Website Architecture Lezione 6: JavaScript.

This section will be the most different for non-Computer Science students, because we will be taking a detour and learning programming. You might as well not read the JavaScript PDF. We are replacing this with the Intro to Programming document and with our use of jQuery, which is in Lezione 6b. You should read those documents, including most/all of 6b, and you should also Google for anything about jQuery which you want to know; your answer will probably come up immediately.

If you must know, this is how the content of the JavaScript lesson, Lezione 6, is divided:

Part 1/3: Language features
Assuming you already knwo programming in general, this gives a quick tour of the specific language features of JavaScript. There are still several concepts in there which are not in the Intro to Programming document, in case you are an intermediate/advanced programmer and you want to learn more.
Part 2/3: The DOM: accessing HTML elements from JS
Introduces the concept of the DOM, which is the structure of JavaScript variables which resemble the elements (tags) of the HTML document. If you modify those JavaScript variables, you modify the way the HTML document appears; this is your way of "crossing over" from JS to HTML. jQuery already does this in a much more convenient way than JavaScript can do alone. Virtually The only reason you'd read this part of the Lezione 6 document would be to learn how jQuery does what it does. This can become more important when evaluating how to make a program faster or more efficient in some way, but that's not realistically going to be your job if you're not in computer science. The other reason why you might like to know how jQuery works is that you're evaluating alternatives for jQuery, which do exist (see end of lesson).
Part 3/3: Events
How to run code when certain events happen, such as when the user clicks on a button or types a key or the page finishes loading or whatever. The code you see in the Intro to Programming document just executes immediately, with no concept of waiting for an event to happen or especially coordinating among multiple events. In real-life JavaScript, this happens all the time, so it is good to become accustomed to this idea and become good at the programming techniques. Fortunately, jQuery also has a simple way of hooking up code to events, so there's not much reason to read this unless you're interested in more details that are usually hidden from you.