O'Reilly logo

JavaScript® Bible, Seventh Edition by Paul Novitski, Danny Goodman, Tia Gustaff Rayl, Michael Morrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. JavaScript Essentials

IN THIS CHAPTER

  • How to combine JavaScript with HTML

  • How to accommodate different versions of JavaScript

  • Language highlights for experienced programmers

When first learning to use JavaScript in the context of the web browser environment, it can be easy to confuse the objects of the JavaScript language with the document objects that we control with JavaScript. It's important to separate the language from the Document Object Model (DOM) to help you make important decisions when designing JavaScript-enhanced pages. You may come to appreciate the separation in the future if you use JavaScript for other object models, such as in server-side programming or scripting Flash animations. All the basics of the language are identical from one context to another; only the objects differ.

This chapter introduces many aspects of the core JavaScript language, particularly as they relate to deploying scripts in a world in which visitors to your pages may use a wide variety of browsers. Along the way, you'll receive additional insights into the language itself. Fortunately, browser differences, as they apply to JavaScript, have lessened considerably as modern browsers continue to inch closer to consistently supporting the JavaScript (ECMAScript) standard. You can find details about the JavaScript core language syntax in Part III.

Combining JavaScript with HTML

Scriptable browsers offer several ways to include scripts or scripted elements in your HTML documents. Not all approaches ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required