HOUR 4: DOM Objects and Built-in Objects
Part II: Cooking with Code
HOUR 5: Numbers and Strings
HOUR 6: Arrays
HOUR 7: Program Control
Part III: Objects
HOUR 8: Object-Oriented Programming
HOUR 9: Scripting with the DOM
HOUR 10: Meet JSON
Part IV: HTML and CSS
HOUR 13: Introducing CSS3
HOUR 14: Using Libraries
HOUR 15: A Closer Look at jQuery
HOUR 16: The jQuery UI User Interface Library
HOUR 17: Ajax with jQuery
Part VI: Advanced Topics
HOUR 18: Reading and Writing Cookies
HOUR 20: Using Frameworks
Part VII: Learning the Trade
HOUR 22: Good Coding Practice
HOUR 23: Debugging Your Code
Part VIII: Appendices
So-called “unobtrusive” scripting techniques and the use of DOM scripting focus on adding interaction to web pages while keeping the HTML simple to read and well separated from the program code.
All of the code examples in the Learning Lab are written as HTML5. For the most part, though, the code avoids using HTML5-specific syntax, since at the time of writing its support in web browsers is still not universal. The code examples should work correctly in virtually any recent web browser, regardless of the type of computer or operating system.
In addition to the main text of each lesson, you will find a number of boxes labeled as Notes, Tips, and Cautions.
After each hour’s lesson, you’ll find three final sections.
These sections provide additional comments that might help you to understand the text and examples.
These blocks give additional hints, shortcuts, or workarounds to make coding easier.
Avoid common pitfalls by using the information in these blocks.
The Learning Lab is divided into seven parts, gradually increasing in the complexity of the techniques taught.
• Part II—Cooking with Code
• Part III—Objects
This part of the Learning Lab concentrates on creating and handling objects, including navigating and editing the objects belonging to the DOM (Document Object Model).
• Part IV—HTML and CSS
In this part of the Learning Lab you learn how to simplify cross-browser development using third-party libraries such as jQuery.
• Part VI—Advanced Topics
• Part VII—Learning the Trade
The examples in this Learning Lab can all be created in a text-editing program, such as the Windows Notepad program. At least one such application ships with just about every operating system, and countless more are available for no or low cost via download from the Internet.
To see your program code working, you’ll need a web browser such as Internet Explorer, Mozilla Firefox, Opera, Safari, or Google Chrome. It is recommended that you upgrade your browser to the latest current stable version.
The vast majority of the Learning Lab examples do not need an Internet connection to function. Simply storing the source code file in a convenient location on your computer and opening it with your chosen browser is generally sufficient. The exceptions to this are the hour on cookies and the examples in the Learning Lab that demonstrate Ajax; to explore all of the sample code will require a web connection (or a connection to a web server on your local area network) and a little web space in which to post the sample code. If you’ve done some HTML coding, you may already have that covered; if not, a hobby-grade web hosting account costs very little and will be more than adequate for trying out the examples in this Learning Lab. (Check that your web host allows you to run scripts written in the PHP language if you want to try out the Ajax examples in Part V. Nearly all hosts do.)
Phil Ballard, the author of various Sams Teach Yourself titles, graduated in 1980 with an honors degree in electronics from the University of Leeds, England. Following an early career as a research scientist with a major multinational, he spent a few years in commercial and managerial roles within the high technology sector, later working full time as a software engineering consultant.
Operating as “The Mouse Whisperer” (www.mousewhisperer.co.uk), Ballard has spent recent years involved solely in website and intranet design and development for an international portfolio of clients, as well as writing numerous technical books and articles.
As the reader of this Learning Lab, you are our most important critic and commentator. We value your opinion and want to know what we’re doing right, what we could do better, what areas you’d like to see us publish in, and any other words of wisdom you’re willing to pass our way.
We welcome your comments. You can email or write to let us know what you did or didn’t like about this Learning Lab—as well as what we can do to make our Learning Lab better.
Please note that we cannot help you with technical problems related to the topic of this Learning Lab.
When you write, please be sure to include this Learning Lab title and author as well as your name and email address. We will carefully review your comments and share them with the author and editors who worked on the Learning Lab.
Mail: Sams Publishing
ATTN: Reader Feedback
800 East 96th Street
Indianapolis, IN 46240 USA
Visit our website and register this Learning Lab at www.informit.com/register for convenient access to any updates, downloads, or errata that might be available for this Learning Lab.