O'Reilly logo

HTML5 and CSS3: Visual QuickStart Guide, Seventh Edition by Bruce Hyslop, Elizabeth Castro

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

Loading an External Script

There are two primary kinds of scripts—those that you load from an external file (in text-only format) and those that are embedded in your page (covered in the next section). It’s the same concept as external and embedded style sheets.

And just as with adding style sheets to your pages, it’s generally better to load scripts from an external file Image than to embed them in your HTML. You reap some of the same benefits, in that a single JavaScript file can be loaded by each page that needs it. You can edit one script rather than updating similar scripts in individual HTML pages.

The src attribute of the script element references ...

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