HTML and CSS Reference
In-Depth Information
syntax of the noscript element is such that it is only applicable in HTML documents
and has no effect in XHTML documents. noscript is one of those elements that had
an uncertain future when XHTML was being pushed by the W3C, and it retains a bit of
a crude and dirty reputation—a hackish—way of handling a disabled script. A better ap-
proach is to write a script that converts the content of a page from a static to a dynamic
nature on the fly, because it's possible a script could fail even when scripting is enabled,
and in that case the contents in noscript would not show up. For instance, consider
the following code (which is embedded in the HTML for brevity's sake):
<div>
<p id="fall-back">Script disabled</p>
<script type="text/javascript">
var fallBack = document.getElementById('fall-back');
var fallBackParent = fallBack.parentNode;
fallBackParent.removeChild(fallBack);
fallBackParent.innerHTML
=
"<button
id='alert-but-
ton'>Show Alert!</button>"
var showAlert = document.getElementById('alert-but-
ton');
showAlert.onclick = function(){alert( "script worked!"
);}
</script>
</div>
A paragraph (with an id set to fall-back ) is provided with some default static
content. A script element follows, which removes the default HTML and replaces it
with a button that has the functionality to show an alert box when clicked. The advant-
age here is that, not only is finer-grained control provided for converting a static page to
a dynamic one, but this will also work in XHTML.
Document sectioning elements
Following the closing head tag is the opening body tag, which can contain any non-
head-specific markup, typically the content that would be expected to appear in the
web browser window content area: paragraphs, lists, images, and so on. The body
tag traditionally had several presentational attributes: background , text , link ,
vlink , and alink , which were used to set the document's background color, text col-
or, link color, visited link color, and active link color, respectively. All of these attrib-
utes were depreciated in HTML 4.01 and have been labeled obsolete in HTML5. Their
Search WWH ::




Custom Search