Schalk Neethling lives in Pretoria, South-Africa where he runs the new media studio Volume4. His work is focused on designing and developing cross-browser, standards based websites and web applications for his clients. In his daily work he uses XHTML, CSS, Javascript, MySQL and Java to create solutions for his clients and has recently released beta versions of Volume4īs open source AlliedBridge CMS and Doc-Central document exchange systems both of which make use of Ajax. Schalk Neethling is also a consultant during the day and is currently on contract developing a Java enterprise application for on of the investment industry leaders in South-Africa.
| Author(s) | Kevin Yank, Cameron Adams |
|---|---|
| Publisher | SitePoint |
| PubDate | June 2007 |
| Reviewer | Schalk Neethling |
![]() |
Purchase and help Javalobby |
|
Positives |
The intended audience of this book would be anyone interested in learning JavaScript. From novice to experienced JavaScripters, everyone will take away a lot from this title.
If you want to learn JavaScript and learn how to code it the right way, you will find the material in this book meets your exact requirements. The content in this book is highly relevant not only to JavaScript but to the entire evolution the web has undergone and is still undergoing.
| Relevance | |
|---|---|
| Readability | |
| Overall | |
Chapter 1: The Three Layers of the Web
The first chapter starts off by explaining how things have evolved from the old-school way of mixing HTML, CSS and JavaScript into the same document to the modern way of keeping things separated. The author discusses the three layers of the web and how to separate your structure, style and behavior the right way.
Chapter 2: Programming with JavaScript
This chapter provides a high level overview of all of the building blocks that makes up a JavaScript program. It starts off by showing how to run a JavaScript application and then moves on to cover topics such as how variables are declared and used in JavaScript as well as the different types of variables available in JavaScript.
Next the author moves on to what a program tick, conditions and loops, also known as program flow control. The discussion then moved from creating code blocks that execute instantly and then stops to writing code for later, i.e functions. After discussing all of the aspects of functions such as passing data to a function, returning data from a function and variable scope, the chapter closes of by discussing unobtrusive scripting in the real world.
Chapter 3: Document Access
Now writing functions, passing data to and from them and setting variables are all well and good but, what truly makes JavaScript useful is it's ability to access the document object model and change our HTML on the fly. So this is where things get exciting and also where you will start building the code library used throughout this book. The Core.js library that you will create as a part of this book is basically similar in nature to Prototype and it really offers a developer a look inside how these libraries work and how they go about solving common cross browser problems.
This chapter covers aspects such as getting elements in the document by id, tag name and class name, how to navigate the DOM tree, how to interact with attributes and how to change styles dynamically. The chapter closes with an implementation of all of these techniques by creating a great reusable script called stripy tables.
Chapter 4: Events
In this chapter you will learn about the events that will trigger those functions discussed earlier in chapter 2. After a discussion about the history of events, the discussion moves to using event handlers and the inherent problems that you will experience when working with event handlers. The discussion moves onto event listeners, the suggested way to work with events. Covered here is coverage of default actions, event propagation the Internet Explorer memory leak and more.
The chapter closes with the development of two examples, rich tool tips as well as an accordion menu system, as well as an exploration of some of the popular libraries out there. Throughout the development of the two examples the author takes every aspect into account from best practices right up to ensuring that these solutions are accessible to screen readers and keyboard users.
Chapter 5: Animation
The chapter starts off with a short discussion on the principles of animation and then moves on to explain how to control time with JavaScript. After coverage of items such as setTimeout, creating repeating timers and stopping setInterval the author revisits the rich tool tip example from the previous chapter. Here you add some animation to the tool tip by slightly delaying the time between mouseover and displaying the tool tip. Next up are some fun examples that demonstrate various aspects of controlling time and dimensions with JavaScript. Create animation using a image reel as well as creating realistic animation by playing soccer JavaScript style, very entertaining and useful.
After finishing off with these examples the author revisits the accordion control and adds the usual slide function that so many sites use out there but, here again best practice and accessibility are always a priority. The chapter finishes with an exploration of the script.aculo.us JavaScript library, well know for its animation effects.
Chapter 6: Form Enhancements
As with CSS, forms are one of the big topics where JavaScript can improve usability. Therefore, this is more then likely one of the most important chapters in this book and as with all of the other sections, the author does not disappoint. The chapter starts off with a discussion on HTML DOM extensions and then jumps right into two examples. The first being dependant fields and the second cascading menus.
Next the discussion moves to probably the biggest use of JavaScript, form validation. The author talks about intercepting form submission, using regular expressions and ends of with an awesome reusable validation script. After this you will build the last example for this chapter, but what an example it is. The author shows you how to build a custom slider control that not only looks awesome but works great and is completely accessible.
The chapter ends with an exploration of libraries and the solutions they provide with respect to form validation and creating custom controls.
Chapter 7: Errors and Debugging
This is, or should I say was, probably one of the most difficult and frustrating aspects of JavaScript development. The author moves through discussions of the different types of errors such as syntax errors, runtime errors and logic errors and how to best test and debug the different variants of errors one is likely encounter.
The chapter ends off with a discussion of the lifesaver for every web developer and scripter. The tool my friends are of course, Firebug. This plug-in have saved many hours, hair and maybe even a life or two.
Chapter 8: Ajax
No why the heck is there a discussion about a soup in a JavaScript book? Oh hold on a second while I climb out from under my rock... Aha, now I see.
Asynchronous JavaScript and XML or as it is better known as, Ajax, is probably on of the biggest reason for the renewed interest and re-uptake of the JavaScript language. Coined by Jesse James Garrett in February 2005, it has single handedly revolutionized what is possible on the web.
Ajax is a big topic and there are many books out there covering this subject in details so, what the author covers here is a high level overview or introduction if you will, into the world of Ajax. He covers aspects such as creating and XMLHttpRequest object and the differences between hoe Internet Explorer and other browsers implement this object.
He moves on to topics such as calling the server, dealing with data, putting Ajax into action and seamless for submission with Ajax. He also covers something not often covered and that is how screen readers behave with regards to Ajax, a very important aspect to take into consideration.
The chapter ends of with a discussion of the various libraries and the different ways the go about making Ajax development easier. Some of the libraries discussed are Prototype, Dojo, jQuery, YUI and MooTools.
Chapter 9: Looking Forward
This is the last chapter in this book and if you want to get inspired and excited, this chapter will do it for you in spades.
The author talks about how JavaScript is bringing a new level of richness to the web. Making finding exactly what you are looking for easier like for example the hotel search widget on Travelocity.com that uses sliders to enable users to easily narrow down their results to exactly what they want. Easier visualization like the inline editing feature on Flickr.com as well as the unique interaction that JavaScript can bring to web pages blurring the line between desktop and browsers based applications. Here the author sites two examples Meebo.com and the amazing Yahoo Pipes mash-up editor.
The author also talks about SVG, canvass and the amazing possibilities this will bring once there is wider support for both of these technologies. Next we move onto something that is all the rage on the web right now, RIA's or rich internet applications. Here the author sites the obvious leader in the space, Google. With apps such as Google docs, Google spreadsheets, Gmail, Google Maps and Analytics, they are demonstrating what the future of the web can be. Also mentioned are Netvibes and Zimbra. The author moves on to discuss widgets and JavaScript of the web. The chapter closes of by an exploration of Dojo and the Google web toolkit.
Appendix A: The Core JavaScript Library
This chapter goes step-by-step through each of the sections of Core.js library that you will build as part of this book. The covers aspects such as event listener methods, script bootstrapping, CSS class management methods, retrieving computed styles and a lot more.