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

Chapter 11. Going Beyond the Box (or Sho... > Thinking Outside the <head>!

Thinking Outside the <head>!

Apart from being nestled inside <script> tags, JavaScript can be put in two other places to run in a Web page. It can either be in a completely separate file altogether and the JavaScript code linked to the Web page using HTML (in a similar way to how images are separate files but appear as part of the main Web page) or be inline in the <body> tag inside other appropriate HTML elements. Both methods have their own advantages and disadvantages, and by the end of this chapter, you'll have a pretty good idea of when and where to use each method. Both ways are easy, and you'll be using them within no time at all!

So, let's begin by looking at how to link JavaScript to the Web page.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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