8. Client-Side Scripting

Up until now, I really haven’t covered any practical uses of JavaScript. You can go only so far manipulating simple data such as strings and arrays. JavaScript is a “scripting language,” which by definition operates inside some kind of environment. Usually, this environment is an HTML document in a Web browser. From here on, this book focuses on interacting with browsers, Web pages, servers, and user input.

Script Tags

HTML provides a means of including executable code in the form of the <script> element. You can include code in a Web page in two ways.

Inline Scripts

Inline scripts include JavaScript code directly in the markup, like this:

Inline scripts allow you to include your code as text right in the Web page. ...

Get The JavaScript PocketGuide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.