In: Computer Science
This is a javascript assignment/study guide for an exam. There are 25 steps that are outlined by // comments...
<html>
<head>
<style type="text/css">
body {font-family:Comic Sans MS;}
</style>
<script language="javascript">
<!--
function fred()
{
//
// There are 25 questions related to the HTML objects shown on the
page
// They are all in the form named "twocities".
//
// Each part of the assignment below instructs you to manipulate or
examine
// the value of the HTML elements and place an answer in one
// of twenty-five span blocks that appear on this page.
//
// e.g., for span block named "ans1" you will say:
//
// ans1.innerHTML = "some string";
//
//
// the questions 1 through 15 below use the string value from the
textarea named "begins"
// stored in a variable named "beg" like this:
beg=document.twocities.begins.value;
len_beg=beg.length;
//
// *** First remove all the periods, commas and hyphens from the
"beg" string before you answer questions 1 through 15
//
//
// ***(1) how many words are the string named "beg"? (words not
characters)
// *** show the answer in the span block with id = "ans1"
//
//
// ***(2) store words in the string "beg" in an array.
// *** show the first and last elements of the array in the span
block with id="ans2"
//
//
// ***(3) show each word in the array produced in (2) above on one
line separated by commas
// *** in the span block with id="ans3"
//
//
// ***(4) create a new string using the value of "beg" where all
the characters are capitalized
// *** show the new string in the span block with id="ans4"
//
//
// ***(5) count the number of times the letters "a", "e", "i", "o",
"u" appear in the string "beg"
// *** show these 5 counts on one line separated by commas in the
span block with id="ans5"
//
//
// ***(6) show the location of each occurence of the character "e"
in the string "beg"
// *** on one line separated by commas in the span block with
id="ans6"
//
//
// ***(7) show the location where each word begins in the string
named "beg"
// *** show the answers on one line separated by commas in the span
block with id="ans7"
//
//
// ***(8) place the words in the string "beg" in a table with a one
pixel border,
// *** with a gray backgound. Use only ten cells per row. Empty
cells should contain
// *** the word "null". Show the table in the span block with
id="ans8"
//
//
// ***(9) replace each occurence of the blank character in "beg"
with the character "*"
// *** show the result in the span block with id="ans9"
//
//
// ***(10) sort the words in array created in (2) into alphabetical
order
// *** show the results in the span block with id="ans10" on a
single line
//
//
// ***(11) show the ASCII character number of each character in the
string "beg"
// *** separate each value with a comma and place the result on a
single line in the span block
// *** with id="ans11"
//
//
// ***(12) count the number of words in the string "beg" that have
2,3,4,5 or 6 characters
// *** show these five counts on a single line separated by commas
in the span block with id="ans12"
//
//
// ***(13) create a new string that contains the words in the
string "beg" in reverse order
// *** show this new string on a single line in the span block with
id="ans13"
//
//
// ***(14) create a new string that contains the characters in the
string "beg" in all capital letters
// *** show this new string on a single line in the span block with
id="ans14"
//
//
// ***(15) store the number of times the letter "a" appears in the
string "beg" in 1st location;
// *** store the number of times the letter "b" appears in the
string "beg" in 2nd location;
// *** store the number of times the letter "c" appears in the
string "beg" in 3rd location;
// *** store the number of times the letter "d" appears in the
string "beg" in 4th location;
// *** etc.
// *** show the 26 counts on one line separated by commas in the
span block with id="ans15"
//
//
// ***(16) Examine the radio buttons and produce a list of the
three "values" of the radios buttons separated by commas on a
single line
// in the span block with id="ans16"
//
// ***(17) Show the value of the radio button which is checked and
its elements number separated by a comma on a line by itself
// *** in the span block with id="ans17"
//
//
// *** (18) Show the elements number and value of the six
checkboxes in a six-row, two-column table with a 2 pixel
border
// *** in the span block with id="ans18"
//
//
// ***(19) Examine the checkboxes and produce a list of the
"values" of the checkboxes that are checked. Separated the values
by commas on a single line
//
//
// ***(20) Show the values of all the options in the select (drop
down menu) named "book3chapters" in an fifteen-column one row table
with a 2 pixel border border
// *** in the span block with id="ans20"
//
//
// ***(21) Show the value of the select (drop down menu) named
"book3chapters" which is selected and its selectedIndex value
separated by a comma on a line by itself
// *** in the span block with id="ans21"
//
//
// *** Retrieve the value of the textarea named "beg" again and
store it in a variable named "beg2", DO NOT REMOVE ANY
CHARACTERS
// *** You will use this string for questions 22 and 23
//
// *** (22) Show the text phrases that are separated by commas in
the string "beg2" . Each phrase should be on a line by
itself.
// *** Place the result in the span block with id="ans22"
//
//
// *** (23) Capitalize the first letter of each phrase from #22
bove (phrases are separated by commas) in the original string
"beg2".
// *** Place each phrase should be on a line by itself.
// *** Place the result in the span block with id="ans23"
//
//
// *** (24) Make the third radio button ("The Track of The Storm")
checked.
// *** Make ALL six of the checkboxes be checked.
// *** Make the select named "book3chapters" (the drop down menu)
show "Fifty-Two" as the selection
// *** Place the string "DONE!" in the span block with
id="ans24"
//
// *** (25) Place the famous last line of the book (without quotes)
in the span block with id="ans25"
//
}
-->
</script>
</head>
<body>
<CENTER>
<TABLE border="2" width="100%">
<TR><TD width="120" valign="middle" align="center"
bgColor="#bbbbbb"><center><IMG align="top" alt="capt
webb" border=2 src="captsm.gif"><BR><span
STYLE="font-size:8px">Capt. Horatio T.P.
Webb</span></center></TD>
<TD valign="middle" bgColor="#bbbbbb" colSpan="2"
align="center"><center><B>ASSIGNMENT #1
Javascript<br>MIS 3371 Transaction Processing
I<BR>Parks -- Spring 2016</B><BR><span
STYLE="font-size:10px">Version 1 -- Last Updated 9:00 AM
1/12/2016</span></center></TD></TR></table></center>
The text used in this assignment is from Charles Dicken's novel "A
Tale of Two Cities" written in 1859<br>Read it at the free
online book site:<br>Project Gutenberg: <a
href="http://www.gutenberg.org/cache/epub/98/pg98.txt">http://www.gutenberg.org/cache/epub/98/pg98.txt</a>
<form name="twocities">
<p>All the HTML elements below are in a form named
"twocities". View "Source" to see the 25 questions.
<p>
<table border="1" cellspacing="0" width="100%">
<tr><td valign="top">1. The textarea below is named
<b>begins</b><br>It contains the opening text of
the book (form elements number 0)
<br><textarea style="margin:6px;" name="begins" rows="10"
cols="80">It was the best of times, it was the worst of
times,
it was the age of wisdom, it was the age of foolishness,
it was the epoch of belief, it was the epoch of incredulity,
it was the season of Light, it was the season of Darkness,
it was the spring of hope, it was the winter of despair,
we had everything before us, we had nothing before us,
we were all going direct to Heaven, we were all going direct the
other way --
in short, the period was so far like the present period,
that some of its noisiest authorities insisted on its being
received,
for good or for evil, in the superlative degree of comparison
only.</textarea></td>
<td valign="top">2. The novel "A Tale of Two Cities" is
divided into 3 books named below.<br>
There are 3 radio buttons below are named:
<b>books</b><br>(form elements 1 →
3).
<br>Their values are: "1", "2" and "3"
<p><input type="radio" name="books" value="1" checked>
Recalled To Life
<br><input type="radio" name="books" value="2"> The
Golden Thread
<br><input type="radio" name="books" value="3"> The
Track of The Storm
</td>
</tr>
<tr><td valign="top">3. The titles of the six chapters
of the first book are shown below.
<br>The 6 checkboxes below are named: <b>c1</b>
→ <b>c6</b> (form elements 4 → 9).
<br>
Their values are the same as the text that appear to the right of
each checkbox.
<br> <input type="checkbox" name="c1" value="The
Period">The Period
<br> <input type="checkbox" name="c2" value="The
Mail" checked>The Mail
<br> <input type="checkbox" name="c3" value="The
Night Shadows">The Night Shadows
<br> <input type="checkbox" name="c4" value="The
Prepartion" checked>The Preparation
<br> <input type="checkbox" name="c5" value="The
Wine Shop">The Wine-shop
<br> <input type="checkbox" name="c6" value="The
Shoemaker" checked>The Shoemaker</b>
</td><td valign="top">4. The select (drop down menu)
below is named <b>book3chapters</b>
<br>(form elements number 10).
<br>The fifteen options are the titles of the fifteen
chapters in Book 3.
<br>The values of the 15 options are the same as the option
text shown on the select below:
<p>
<select name="book3chapters">
<option value="In Secret">In Secret
<option value="The Grindstone">The Grindstone
<option value="The Shadow">The Shadow
<option value="Calm in Storm">Calm in Storm
<option value="The Wood-sawyer">The Wood-sawyer
<option value="Triumph">Triumph
<option value="A Knock at the Door">A Knock at the Door
<option value="A Hand at Cards">A Hand at Cards
<option value="The Game Made">The Game Made
<option value="The Substance of the Shadow">The Substance of
the Shadow
<option value="Dusk">Dusk
<option value="Darkness">Darkness
<option value="Fifty-two">Fifty-two
<option value="The Knitting Done">The Knitting Done
<option value="The Footsteps Die Out For Ever">The Footsteps
Die Out For Ever
</select></b></td></tr></table>
</form>
<p>
<ol>
<li><span id="ans1">Contents of the span block with
id="LuL"</span>
<li><span id="ans2">Contents of the span block with
id="ans2"</span>
<li><span id="ans3">Contents of the span block with
id="ans3"</span>
<li><span id="ans4">Contents of the span block with
id="ans4"</span>
<li><span id="ans5">Contents of the span block with
id="ans5"</span>
<li><span id="ans6">Contents of the span block with
id="ans6"</span>
<li><span id="ans7">Contents of the span block with
id="ans7"</span>
<li><span id="ans8">Contents of the span block with
id="ans8"</span>
<li><span id="ans9">Contents of the span block with
id="ans9"</span>
<li><span id="ans10">Contents of the span block with
id="ans10"</span>
<li><span id="ans11">Contents of the span block with
id="ans11"</span>
<li><span id="ans12">Contents of the span block with
id="ans12"</span>
<li><span id="ans13">Contents of the span block with
id="ans13"</span>
<li><span id="ans14">Contents of the span block with
id="ans14"</span>
<li><span id="ans15">Contents of the span block with
id="ans15"</span>
<li><span id="ans16">Contents of the span block with
id="ans16"</span>
<li><span id="ans17">Contents of the span block with
id="ans17"</span>
<li><span id="ans18">Contents of the span block with
id="ans18"</span>
<li><span id="ans19">Contents of the span block with
id="ans19"</span>
<li><span id="ans20">Contents of the span block with
id="ans20"</span>
<li><span id="ans21">Contents of the span block with
id="ans21"</span>
<li><span id="ans22">Contents of the span block with
id="ans22"</span>
<li><span id="ans23">Contents of the span block with
id="ans23"</span>
<li><span id="ans24">Contents of the span block with
id="ans24"</span>
<li><span id="ans25">Contents of the span block with
id="ans25"</span>
</ol>
<br><input type="button" value="this button executes the
function fred()" onClick="fred()">
</body>
</HTML>
// the questions 1 through 15 below use the string value from the
textarea named "begins"
// stored in a variable named "beg" like this:
beg=document.twocities.begins.value;
len_beg=beg.length;
//
/ *** First remove all the periods, commas and hyphens from the
"beg" string before you answer questions 1 through 15
//
while(beg.indexOf(", ")>-1)
{
beg = beg.replace(", "," ");
}
while(beg.indexOf(",")>-1)
{
beg = beg.replace(","," ");
}
while(beg.indexOf("-")>-1)
{
beg = beg.replace("-","");
}
while(beg.indexOf(".")>-1)
{
beg = beg.replace(".","");
}
/
// ***(1) how many words are the string named "beg"? (words not
characters)
// *** show the answer in the span block with id = "ans1"
//
one = beg.split(" ");
ans1.innerHTML = one.length;
//
// ***(2) store words in the string "beg" in an array.
// *** show the first and last elements of the array in the span
block with id="ans2"
//
two = beg.split(" ");
ans2.innerHTML = two[0] +" "+two[two.length-1];
//
// ***(3) show each word in the array produced in (2) above on one line separated by commas
// *** in the span block with id="ans3"
//
for(i=0;i<two.length;i++)
{
while(two[i].indexOf("\n")>-1)
{
two[i] = two[i].replace("\n","");
}
}
ans3.innerHTML = two;
//
// ***(4) create a new string using the value of "beg" where all the characters are capitalized
// *** show the new string in the span block with id="ans4"
//
four = beg.toUpperCase();
ans4.innerHTML = four;
//
// ***(5) count the number of times the letters "a", "e", "i",
"o", "u" appear in the string "beg"
// *** show these 5 counts on one line separated by commas in the
span block with id="ans5"
//28, 69, 44, 44, 5
//should this count the capital "I" ??????
five = beg.split("");
a = 0;
e = 0;
i = 0;
o = 0;
u = 0;
for(j=0;j<five.length;j++)
{
if(five[j] == "a")
{
a++;
}
else if(five[j] == "e")
{
e++;
}
else if(five[j] == "i")
{
i++;
}
else if(five[j] == "o")
{
o++;
}
else if(five[j] == "u")
{
u++;
}
}
ans5.innerHTML = a + ", " + e + ", " + i + ", " + o + ", " +
u;
//
// ***(6) show the location of each occurence of the character "e"
in the string "beg"
// *** on one line separated by commas in the span block with
id="ans6"
//
six = beg.split("");
six2 = [];
for(i=0;i<six.length;i++)
{
if(six[i] == "e")
{
six2.push(i);
}
}
ans6.innerHTML = six2;
//
/ ***(7) show the location where each word begins in the string
named "beg"
// *** show the answers on one line separated by commas in the span
block with id="ans7"
//
seven = beg.split("");
seven2 = [];
for(i=0;i<seven.length;i++)
{
if(seven[i] !== " " && i == 0)
{
seven2.push(i);
}
else if(seven[i] !== " " && seven[i-1] == " ")
{
seven2.push(i);
}
}
ans7.innerHTML = seven2;
//
// ***(8) place the words in the string "beg" in a table with a
one pixel border,
// *** with a gray backgound. Use only ten cells per row. Empty
cells should contain
// *** the word "null". Show the table in the span block with
id="ans8"
//
eos = "<table border = '1' style = 'background:
gray'>";
run = Math.ceil(two.length / 10);
num8 = 0;
for(i =1;i<=run;i++)
{
eos = eos +"<tr>";
for(j=1;j<=10;j++)
{
if(two[num8] === undefined)
{
eos = eos +"<td>null</td>";
}
else
{
eos = eos +"<td>"+two[num8]+"</td>";
}
num8++;
}
eos = eos + "</tr>";
}
eos = eos +"</table>";
ans8.innerHTML = eos;
//
// ***(9) replace each occurence of the blank character in "beg"
with the character "*"
// *** show the result in the span block with id="ans9"
//
nine = beg.split("");
for(i=0;i<nine.length;i++)
{
if(nine[i] == " ")
{
nine[i] = nine[i].replace(" ","*");
}
}
ans9.innerHTML = nine.join("");
//
// ***(10) sort the words in array created in (2) into alphabetical
order
// *** show the results in the span block with id="ans10" on a
single line
//
for(i=0;i<two.length;i++)
{
two[i] = two[i].toLowerCase();
}
ans10.innerHTML = two.sort();
//
// ***(11) show the ASCII character number of each character in
the string "beg"
// *** separate each value with a comma and place the result on a
single line in the span block
// *** with id="ans11"
//
eleven = beg.split("");
eleven11 = [];
for(i=0;i<eleven.length;i++)
{
eleven11.push(eleven[i].charCodeAt(0));
}
ans11.innerHTML = eleven11;
//
words in the string "beg" that have 2,3,4,5 or 6
characters
// *** show these five counts on a single line separated by commas
in the span block with id="ans12"
//
twelve = beg.split(" ");
for(i=0;i<twelve.length;i++)
{
while(twelve[i].indexOf("\n")>-1)
{
twelve[i] = twelve[i].replace("\n","");
}
}
twelve2 = [0,0,0,0,0];
for(i=0;i<twelve.length;i++)
{
if(twelve[i].length == 2)
twelve2[0]++;
else if(twelve)
twelve2 = [0,0,0,0,0];
for(i=0;i<twelve.length;i++)
{
if(twelve[i].length == 2)
twelve2[0]++;
else if(twelve[i].length == 3)
twelve2[1]++;
else if(twelve[i].length
twelve2[2]++;
else if(twelve[i].length == 5)
twelve2[3]++;
else if(twelve[i].length == 6)
twelve2[4]++;
}
var os12= "";
for(i=0;i<twelve.length;i++)
{
if(twelve[i].length == 2)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length == 3)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length==4)
os12+=twelvtwelve2 = [0,0,0,0,0];
for(i=0;i<twelve.length;i++)
{
if(twelve[i].length == 2)
twelve2[0]++;
else if(twelve[i].lengt[i].length == 3)
twelve2[1]++;
else if(twelve[i].length == 4)
twelve2[2]++;
else if(twelve[i].length == 5)
twelve2[3]++;
else if(twelve[i].length == 6)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length == 6)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
}
ans12.innerHTML = os12;
//
// ***(13) create a new string that contains the words in the
string {
twelve[i] = twelve[i].replace("\n","");
}
}
for(i=0;i<twelve.length;i++)
{
if(twelve[i].length == 2)
twelve2[0]++;
else if(twelve[i].length == 3)
twelve2[1]++;
else if(twelve[i].length == 4)
twelve2[2]++;
else if(twelve[i].length == 5)
twelve2[3]++;
else if(twelve[i].length == 6)
twelve2[4]++;
}
var os12= "";
for(i=0;i<twelve.length;i++)
{
if(twelve[i].length == 2)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length == 3)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length == 4)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length == 5)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
else if(twelve[i].length == 6)
os12+=twelve[i]+"-"+twelve[i].length+"<br>";
}
ans12.innerHTML = os12;
//
// ***(13) create a new string that contains the words in the string "beg" in reverse order
// *** show this new string on a single line in the span block with id="ans13"
//
"beg" in reverse order
// *** show this new string on a single line in the span block with id="ans13"
//
n the span block with id="ans13"
//
thirteen = beg.split(" ");
thirteen2= [];
for(i=0;i<thirteen.length;i++)
{
tt = thirteen[i].split("");
tt2 = "";
for(j=tt.length-1;j>=0;j--)
{
if(tt[j].charCodeAt(0) >= 65)
{
tt2 += tt[j];
}
}
thirteen3 = thirteen2.join(" ");
ans13.innerHTML = thirteen3;
//
// ***(14) create a new string that contains the characters in the
string "beg" in all capital letters
// *** show this new string on a single line in the span block with
id="ans14"
//
//what's the diffference between this and Number 4....?
beg14 = beg.toUpperCase();
ans14.innerHTML = beg14;
//
// ***(15) store the number of times the letter "a" appears in
the string "beg" in 1st location;
// *** store the number of times the letter "b" appears in the
string "beg" in 2nd location;
// *** store the number of times the letter "c" appears in the
string "beg" in 3rd location;
// *** store the number of times the letter "d" appears in the
string "beg" in 4th location;
// *** etc.
// *** show the 26 counts on one line separated by commas in the
span block with id="ans15"
//
fifteen = []
for(i=0;i<26;i++)
fifteen[i] = 0;
beg15 = beg.toLowerCase();
beg15.split("");
for(i=0;i<beg15.length;i++)
{
fifteen[beg15[i].charCodeAt(0) - 97]++;
}
ans15.innerHTML = fifteen;
//
// ***(16) Examine the radio buttons and produce a list of the
three "values" of the radios buttons separated by commas on a
single line
// in the span block with id="ans16"
var theform = window.document.twocities;
sixteen = [];
for(i =1;i<4;i++)
{
sixteen.push(theform.elements[i].value);
}
ans16.innerHTML = sixteen;
//
// ***(17) Show the value of the radio button which is checked and its elements number separated by a comma on a line by itself
// *** in the span block with id="ans17"
//
seventeen = "";
for(i =1;i<4;i++)
{
if(theform.elements[i].checked)
{
seventeen = theform.elements[i].value +"<br>,<br>"+i;
}
}
ans17.innerHTML = seventeen;
//
// *** (18) Show the elements number and value of the six
checkboxes in a six-row, two-column table with a 2 pixel
border
// *** in the span block with id="ans18"
//
os18 = "<table border = '2'>";
for(i=4;i<10;i++)
{
os18+="<tr><td>"+i+"</td><td>"+theform.elements[i].value+"</td></tr>";
}
os18+="</table>";
ans18.innerHTML = os18;
//
// ***(19) Examine the checkboxes and produce a list of the
"values" of the checkboxes that are checked. Separated the values
by commas on a single line
//
nineteen = [];
for(i=4;i<10;i++)
{
if(theform.elements[i].checked)
nineteen.push(theform.elements[i].value)
}
ans19.innerHTML = nineteen;
//
/ ***(20) Show the values of all the options in the select (drop down menu) named "book3chapters" in an fifteen-column one row table with a 2 pixel border border
// *** in the span block with id="ans20"
//
os20= "<table border = '2'>";
for(i=0;i<15;i++)
{
os20+="<tr><td>"+theform.book3chapters.options[i].text+"</td><tr>";
}
os20+="</table>";
ans20.innerHTML = os20;
//
// ***(21) Show the value of the select (drop down menu) named
"book3chapters" which is selected and its selectedIndex value
separated by a comma on a line by itself
// *** in the span block with id="ans21"
//
twentyone = theform.book3chapters.selectedIndex
twentyone2 = theform.book3chapters.options[twentyone].text;
ans21.innerHTML =
twentyone2+"<br>,<br>"+twentyone;
//
// *** Retrieve the value of the textarea named "beg" again and
store it in a variable named "beg2", DO NOT REMOVE ANY
CHARACTERS
// *** You will use this string for questions 22 and 23
beg2 = document.twocities.begins.value;
//
// *** (22) Show the text phrases that are separated by commas in the string "beg2" . Each phrase should be on a line by itself.
// *** Place the result in the span block with id="ans22"
//
beggy2 = beg2.split("");
twentytwo = [0];
os22 = "";
for(i=0;i<beggy2.length;i++)
{
if(beggy2[i] == ",")
{
for(j=i+1;j<beggy2.length;j++)
{
if(beggy2[j].charCodeAt(0) >= 65)
{
twentytwo.push(j);
j = beggy2.length;
}
}
}
}
twentytwo.push(beggy2.length);
for(i=1;i<twentytwo.length;i++)
{
os22+= beg2.substring(twentytwo[i-1],twentytwo[i])+"<br>";
}
ans22.innerHTML = os22;
//
// *** (23) Capitalize the first letter of each phrase from #22
above (phrases are separated by commas) in the original string
"beg2".
// *** Place each phrase should be on a line by itself.
// *** Place the result in the span block with id="ans23"
//
os23 = "";
for(i=1;i<twentytwo.length;i++)
{
os23+=
beg2.substr(twentytwo[i-1],1).toUpperCase()+beg2.substring(twentytwo[i-1]+1,twentytwo[i])+"<br>";
}
ans23.innerHTML = os23;
//
// *** (24) Make the third radio button ("The Track of The
Storm") checked.
// *** Make ALL six of the checkboxes be checked.
// *** Make the select named "book3chapters" (the drop down menu)
show "Fifty-Two" as the selection
// *** Place the string "DONE!" in the span block with
id="ans24"
theform.elements[3].checked = 'true';
for(i=4;i<10;i++)
{
theform.elements[i].checked = 'true';
}
theform.book3chapters.selectedIndex = 12;
ans24.innerHTML = "DONE!";
//
(25) Place the famous last line of the book (without quotes) in
the span block with id="ans25"
//
ans25.innerHTML = "It is a far, far better thing that I do, than I
have ever done; it is a far, far better rest that I go to than I
have ever known."
}
-->
<p>
<table border="1" cellspacing="0" width="100%">
<tr><td valign="top">1. The textarea below is named
<b>begins</b><br>It contains the opening text of
the book (form elements number 0)
<br><textarea style="margin:6px;" name="begins" rows="10"
cols="80">It was the best of times, it was the worst of
times,
it was the age of wisdom, it was the age of foolishness,
it was the epoch of belief, it was the epoch of incredulity,
it was the season of Light, it was the season of Darkness,
it was the spring of hope, it was the winter of despair,
we had everything before us, we had nothing before us,
we were all going direct to Heaven, we were all going direct the
other way --
in short, the period was so far like the present period,
that some of its noisiest authorities insisted on its being
received,
for good or for evil, in the superlative degree of comparing
only</textarea></td>
<td valign="top">2. The novel "A Tale of Two Cities" is
divided into 3 books named below.<br>
There are 3 radio buttons below are named:
<b>books</b><br>(form elements 1 →
3).
<br>Their values are: "1", "2" and "3"
<p><input type="radio" name="books" value="1" checked>
Recalled To Life
<br><input type="radio" name="books" value="2"> The
Golden Thread
<br><input type="radio" name="books" value="3"> The
Track of The Storm
</td>
</tr>
<tr><td valign="top">3. The titles of the six
chapters of the first book are shown below.
<br>The 6 checkboxes below are named: <b>c1</b>
→ <b>c6</b> (form elements 4 → 9).
<br>
Their values are the same as the text that appear to the right of
each checkbox.
<br> <input type="checkbox" name="c1" value="The
Period">The Period
<br> <input type="checkbox" name="c2" value="The
Mail" checked>The Mail
<br> <input type="checkbox" name="c3" value="The
Night Shadows">The Night Shadows
<br> <input type="checkbox" name="c4" value="The
Prepartion" checked>The Preparation
<br> <input type="checkbox" name="c5" value="The
Wine Shop">The Wine-shop
<br> <input type="checkbox" name="c6"
value="The Shoemaker" checked>The Shoemaker</b>
</td><td valign="top">4. The select (drop down menu)
below is named <b>book3chapters</b>
<br>(form elements number 10).
<br>The fifteen options are the titles of the fifteen
chapters in Book 3.
<br>The values of the 15 options are the same as the option
text shown on the select below:
<p>
<select name="book3chapters">
<option value="In Secret">In Secret
<option value="The Grindstone">The Grindstone
<option value="The Shadow">The Shadow
<option value="Calm in Storm">Calm in Storm
<option value="The Wood-sawyer">The Wood-sawyer
<option value="Triumph">Triumph
<option value="A Knock at the Door">A Knock at the Door
<option value="A Hand at Cards">A Hand at Cards
<option value="The Game Made">The Game Made
<option value="The Substance of the Shadow">The Substance of
the Shadow
<option value="Dusk">Dusk
<option value="Darkness">Darkness
<option value="Fifty-two">Fifty-two
<option value="The Knitting Done">The Knitting Done
<option value="The Footsteps Die Out For Ever">The Footsteps
Die Out For Ever
</select></b></td></tr></table>
</form>
<p>
<ol>
<li><span id="ans1">Contents of the span block with
id="ans1"</span>
<li><span id="ans2">Contents of the span block with
id="ans2"</span>
<li><span id="ans3">Contents of the span block with
id="ans3"</span>
<li><span id="ans4">Contents of the span block with
id="ans4"</span>
<li><span id="ans5">Contents of the span block with
id="ans5"</span>
<li><span id="ans6">Contents of the span block with
id="ans6"</span>
<li><span id="ans7">Contents of the span block with
id="ans7"</span>
<li><span id="ans8">Contents of the span block with
id="ans8"</span>
<li><span id="ans9">Contents of the span block with
id="ans9"</span>
<li><span id="ans10">Contents of the span block with
id="ans10"</span>
<li><span id="ans11">Contents of the span block with
id="ans11"</span>
<li><span id="ans12">Contents of the span block with
id="ans12"</span>
<li><span id="ans13">Contents of the span block with
id="ans13"</span>
<li><span id="ans14">Contents of the span block with
id="ans14"</span>
<li><span id="ans15">Contents of the span block with
id="ans15"</span>
<li><span id="ans16">Contents of the span block with
id="ans16"</span>
<li><span id="ans17">Contents of the span block with
id="ans17"</span>
<li><span id="ans18">Contents of the span block with
id="ans18"</span>
<li><span id="ans19">Contents of the span block with
id="ans19"</span>
<li><span id="ans20">Contents of the span block with
id="ans20"</span>
<li><span id="ans21">Contents of the span block with
id="ans21"</span>
<li><span id="ans22">Contents of the span block with
id="ans22"</span>
<li><span id="ans23">Contents of the span block with
id="ans23"</span>
<li><span id="ans24">Contents of the span block with
id="ans24"</span>
<li><span id="ans25">Contents of the span block with
id="ans25"</span>
</ol>
<br><input type="button" value="this button executes the
function fred()" onClick="fred()">
</body>
</HTML>