Navigation




JavaScript

JavaScript is a programming language that runs in your Web browser. You can use it to change colors and fonts, move images around, check data in forms, do computations, and lots of other things.

JS programs are downloaded with a Web page, either embedded in them or linked to them. They run when the Web page loads, and/or later, in response to events, like mouse clicks.

Aptana offers good support for JS programming. It does automatic indenting, shows matching braces, and so on.

If you have programmed before, you will find JavaScript easy to learn and use.

If you have not programmed before, you will find this challenging. Not because of JS - it's one of the easiest languages to learn. But programming requires you to think precisely, more precisely than you are used to. Learning how to structure your thoughts takes practice.

Do not expect to be able to just read and understand. You need to do exercises. You need to modify existing code, set yourself your own problems. You need to search the Web for more tutorials on things you don't understand. The Web has many thousands of pages about JS. You'll find stuff for you.

Here's what we'll do.

Introducing JavaScript

You'll see how to include JavaScript in your pages, how to create variables, and how to do simple input and output.

Learning goals: Variables, assignment statements, alert(), prompt(), access form element with jQuery, if statement.

Introducing jQuery

jQuery makes JS programming much easier. You can change how your page looks, depending on what the user does.

Learning goals: Show how to add jQuery library. Binding functions to events. Getting/setting form data, changing HTML, changing styles, showing/hiding, focus.

Formy goodness

Forms are important ways of interacting with users. Let's make them dance and sing.

Learning goals: Typical form interaction (validation, computing results, results preview and confirmation). Form validation pattern. Status messages.

Accumulating data

You'll write JS programs that accumulate data over time, and report results.

Learning goals: Variable initialization. Variable scope. Motivate arrays.

Arrays and loops

Arrays let JS programs handle large amount of data. It takes no more code to handle a hundred variables than it does to handle ten.

Learning goals: Arrays, loops for totaling and statistics.

More loopiness

Business processing often involves tables of data, where each row describes a product, a customer, or some other entity, and each column is an entity attribute, like an id number, a name, or a spleen weight.

Learning goals: Associative arrays, records (multi-array, 2D).