• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 18. Introduction to JavaScripting > JavaScript and Web Browsers

JavaScript and Web Browsers

The most important thing you will be doing with your JavaScripts is interacting with the content and information on your Web pages, and through it, with your user. JavaScript interacts with your Web browser through the browser's object model. Different aspects of the Web browser exist as different objects, with properties and methods that can be accessed by JavaScript. For instance, document.write() uses the write method of the document object. Understanding this Web Browser Object Model is crucial to using JavaScript effectively. Also, understanding how the Web browser processes and executes your scripts is also necessary.

When Scripts Execute

When you put JavaScript code in a page, the Web browser evaluates the code as soon as it is encountered. Functions, however, don't get executed when they're evaluated; they get stored for later use. You still have to call functions explicitly to make them work. Some functions are attached to objects—buttons or text fields on forms, for example, which are called when some event happens on the button or field. You might also have functions that you want to execute during page evaluation. You can do so by putting a call to the function at the appropriate place in the page.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint