You can perform form validation before the form has even been submitted. For
example, have you ever tried signing up for a service only to find that the user ID was already
taken? You??™d hit the Back button, try a different name (and retype your password because it is
never retained), and resubmit. This cycle would annoyingly repeat itself until you found an
unused name. With Ajax, you can check the user ID while the user is completing the rest of the
form. If the name is taken, an error message displays to the user, who can fix it before submitting
the form.
With this new power, developers have been pulling out all the stops to build some dazzling
applications. Alas, many are more glitz than guts; more pizzazz than power. While you might
find yourself wanting to add the latest trick, it will always be important to think about usability
and accessibility in all you put together. This topic will be discussed throughout the book.
Managing JavaScript
These days, JavaScript-based applications can get large and unwieldy. Before you get into any
JavaScript, I want to talk about where to place code in an HTML page and the best approaches
for long-termmaintenance. There are some nuances that are important to remember when
testing and evaluating your own code.
Code Loading
The first process to understand is the loading process. When an HTML page loads, it loads and
evaluates any JavaScript that it comes across in the process.
Pages:
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42