Appendix C Snippets

p. 737

Sample HTML Code:

<html>
<head>
<title>Sample HTML Tags</title>
</head>
<body>
<h1 align="center">Samples of Basic HTML Tags</h1>
The font for plain body text depends on the browser settings.
<b>This is bold. </b>
<i>This is italic. </i>This is not.
<i><b>This is both.</b></i>
<p/>New paragraph before this sentence.<br/>Line break before this sentence.

<br/>Extra spaces without special characters are ignored.

<p/>Line breaks
in
the code are ignored.
<p/>

<!-- A comment: the anchor tag has several attributes.
HREF is one -->
JDeveloper is a product of
<a href="http://www.oracle.com">Oracle Corporation </a>&copy;2004.

<hr width="80%" align="center" />
<b>Unordered List</b>
<ul>
<li>An item in a list </li>
<li>Another item in a list </li>
<li>Yet another item in a list </li>
</ul>
</body>
</html>

p. 739

JavaScript in HTML:

<html>
<head>
<script language="JavaScript">
<!--
function checkRequired(which) {
if (which.fname.value == ') {
alert("The Name field is required.");
return false;
}
else {
alert("The Name = \"" + which.fname.value +"\"");
which.fname.value = which.fname.value.toUpperCase();
return true;
}
}
-->
</script>
</head>

<body>
<form onsubmit="return checkRequired(this)">
First Name: <input type="text" name="fname">
<p><input type=submit value="Save">
</form>
</body>
</html>

p. 741

Building a Cascading Style Sheet:

<!--
/*
|| demo.css style sheet
*/

H2 {
font-family: Arial;
font-style: italic;
color: BLUE;
}

BODY
{
background-color:#DDDDDD;
}

.emphasis
{
color: black;
font-weight: bold;
font-style: italic;
}

P.codeText{
font-family: Courier;
color: BLACK;
font-weight: BOLD;
font-size: 10pt;
}

TH {
color:WHITE;
background-color:#888888;
font-weight: BOLD;
}

TD {
color:BLACK;
background-color:WHITE;
}
-->

p. 742

Using a Cascading Style Sheet:

<html>
<head>
<title>CSS Demo</title>
<link rel="stylesheet" type="text/css" href="demo.css">
</head>
<body>
This is normal body text. The body background is gray.
<p class="emphasis">
This uses the EMPHASIS style.
</p>
<p class="codeText">// Java code sample comment</p>
<P>
<h2>An H2 header is blue by default.</h2>
<table border=0>
<tr>
<th>ID<th>
<th>Name<th>
</tr>
<tr>
<td>101<td>
<td>Tiger<td>
</tr>
<tr>
<td class="emphasis">102<td>
<td class="emphasis">Dragon<td>
</tr>
</table>
</body>
</html>