IN THIS CHAPTER
Client-side versus server-side scripting
Setting the default scripting language
Including a script
Calling an external script
Triggering scripts with events
Hiding scripts from older browsers
Standard HTML was designed to provide static, text-only documents. No innate intelligence is built into plain HTML, but it is desired, especially in more complex documents or documents designed to be interactive. Enter scripts — svelte programming languages designed to accomplish simple tasks while adhering to the basic premise of the Web, easily deployable content that can play nicely with plain-text HTML.
This chapter covers scripting basics and goes into the details of how to use client-side scripting in your documents.
There are two basic varieties of scripting, client-side and server-side. As their names imply, the main difference is where the scripts are actually executed.
Client-side scripts are run by the client software — that is, the user agent. As such, they impose no additional load on the server, but the client must support the scripting language being used.
For security reasons, client-side scripts generally cannot read or write to the server or client ...