web programming 3.4

Ace your homework & exams now with Quizwiz!

<script>

tag allows a web page to include interactive content, which the browser assumes to be JavaScript unless indicated otherwise. The optional type attribute is used to indicate the content type when the content is not JavaScript. The src attribute provides the URL of an external document containing the interactive content. If a <script> tag does not have the src attribute, then the interactive content is contained directly within the tag. The HTML below shows two ways the <script> tag can be used.

<style>

tag allows the web page to introduce presentational directives, usually CSS. A <style> tag is placed in an HTML document prior to the <body> tag, because the style section is designed to describe the presentation of the entire document.

common error

to forget the closing </script> tag when using the src attribute. Even when the interactive content is located in a separate external document, the closing </script> tag must be included.

Good practice

to use the src attribute to separate content and functionality and promote modularity. An external JavaScript file can be edited separately from an HTML file, which allows a web page's interactive content to be updated even if the content is unchanged. A separate JavaScript file can also be reused on many web pages to provide the same functionality for different pieces of content. Additionally, when the JavaScript file is separate, a browser that doesn't understand JavaScript, such as a screenreader for blind users, can avoid downloading the JavaScript file that will not be used.


Related study sets

Principals of Microeconomics Final Exam Review

View Set

Civil Engineering(Past Boards 2019)

View Set

Solving Linear Equations: Distributive Property: Assignment

View Set

Chapter 2 LearnSmart Questions-HW

View Set

Med Surg 2 - Chap 45, 6infection dew, IGGY CH. 23 CARE OF PTS WITH INFECTION, Ch 37. Care of Patients with Shock, Chapter 67 Sepsis, Ch 66 Shock, Sepsis, & MODS, Med Surg: Chapter 66 Critical Care, PEDS: Chapter 54: The Child with a Developmental Dis...

View Set

CCNA Chapter 4 Practice Questions

View Set

A Sociology of the Family Inquisitive

View Set

Business Finance Ch 11 Homework - Connect

View Set

Chapter 9 - The Post Effective Period

View Set

Глава 1: Знакомство с колледжем

View Set

Lecture Exam 3: Reproductive (updated 4.10.15)

View Set