HTML and CSS Reference
In-Depth Information
The doctype declaration tells the Web browser what version of the markup lan-
guage will be used for this page and should be the very first thing in an HTML
document, and must be included in an XHTML document.The doctype declara-
tion refers to a Document Type Definition (DTD). The DTD specifies the rules for
the markup language, so that the browsers can render the content correctly. This
document is declared to be HTML 4.01 Strict. HTML 4.01 Strict is a version of
HTML 4.01 that emphasizes structure over presentation. Deprecated elements
and attributes, frames, and link targets are not allowed in HTML 4 Strict. In most
of the examples in this topic, this declaration will be omitted just to save space,
but when you create your own documents, you should include the doctype dec-
This is the starting tag for an HTML document.
This is the HTML <head> tag. The <head> tags contain all the elements that don't be-
long in the body of the document, such as the <title> tags, as well as JavaScript tags.
The <body> tag defines the background color and text color for the document.
This <script> tag is the starting HTML tag for the JavaScript script, which consists
of a mix of textual content and JavaScript instructions. JavaScript instructions are
placed between this tag and the closing </script> tag. JavaScript understands Java-
Script instructions, not HTML.
The JavaSc ipt writeln method is called for the document. The string enclosed
in parentheses is passed to the JavaScript interpreter. If the JavaScript interpreter
encounters HTML content, it sends that content to the HTML renderer and it is
printed into the document on the browser. The normal HTML parsing and ren-
dering resumes after the closing JavaScript tag is reached.
This is the ending JavaScript tag. The output is shown in Figure 1.14.
HTML tags and text continue in the body of the document.
The body of the document ends here.
This is the ending tag for the HTML document.
Figure 1.14 Example 1.5 output: JavaScript has been inserted in a document.
Search WWH ::

Custom Search