This is the main page that frames two pages.
it is called: main.htm
<HTML> <HEAD> <TITLE> </TITLE> </HEAD> <FRAMESET COLS="10%,80%"> <FRAME SRC="Left.htm" NAME="buttonsFrame"> <FRAME SRC="Center.htm" NAME="getWords"> </FRAMESET><noframes></noframes>
this one is called: Left.htm
<HTML>
<HEAD>
<TITLE>
</TITLE>
<script LANGUAGE="JavaScript">
<!--
function doMadLib()
{
document.frame[2].confirm()
var w = window.open('');
w.document.write("<p>Once upon a time a"
+ document.frame[2].allwords[0].value
+ ", a"
+ document.frame[2].allwords[1].value
+ " and a"
+ document.frame[2].allwords[2].value
+ " decided to go "
+ document.frame[2].allwords[4].value
+ ". They gathered their "
+ document.frame[2].allwords[4].value
+ " gear and headed down to "
+ document.frame[2].allwords[5].value
+ " Lake. Once they got to the lake "
+ "they looked for a boat to rent. A "
+ document.frame[2].allwords[0].value
+ " named "
+ document.frame[2].allwords[6].value
+ " owned the only boat for rent. "
+ document.frame[2].allwords[6].value
+ " wanted $50 for one day's rental. Neither the "
+ document.frame[2].allwords[0].value
+ ", the "
+ document.frame[2].allwords[1].value
+ " nor the "
+ document.frame[2].allwords[2].value
+ " had enough money to rent the boat. So they said to "
+ document.frame[2].allwords[6].value
+ " the "
+ document.frame[2].allwords[3].value
+ ", Why don't you come with us.?No said "
+ document.frame[2].allwords[6].value
+ ", I have other things to do today. I promised my friend "
+ "I would help fix his "
+ document.frame[2].allwords[7].value
+ " today. I need the money to buy a new "
+ document.frame[2].allwords[9].value
+ " for his "
+ <document.frame[2].allwords[7].value
+ ". But the "
+ document.frame[2].allwords[0].value
+ ", the "
+ document.frame[2].allwords[1].value
+ " and the "
+ document.frame[2].allwords[2].value
+ " said, We don't have the money to pay you. If "
+ "there is no money for the "
+ document.frame[2].allwords[9].value
+ " then you can't fix the "
+ document.frame[2].allwords[7].value
+ ". So you might as well go "
+ document.frame[2].allwords[5].value
+ " with us. OK said "
+ document.frame[2].allwords[6].value
+ " and so that is how the "
+ document.frame[2].allwords[0].value
+ ", "
+ document.frame[2].allwords[1].value
+ ", the "
+ document.frame[2].allwords[2].value
+ " and the "
+ document.frame[2].allwords[3].value
+ " all went "
+ document.frame[2].allwords[4].value
+ " that "
+ document.frame[2].allwords[8].value
+ document.frame[2].allwords[10].value
+ " day."</p>");
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<P>
</P>
</BODY>
<INPUT type="button" value="Play" name=btnPlay onClick = "doMadLib()">
<BR><BR>
<INPUT type="button" value="Reset" name=btnreset onClick = "document.frame[2].reset()">
</HTML>
this one is called: Center.htm
<html>
<head>
<title> </title>
</head>
<body bgcolor="#FFFFFF">
<script language="JavaScript">
<!--
function Submit()
{
for(i=0;i<9;i++)
{
for(j=i+1;j<10;j++)
{
if(document.frmGetWords.allwords[i].value==document.frmGetWords.allwords[j].value)
{
alert("Same word cannot be used more than once.");
}
if(document.frmGetWords.allwords[j].value=="")
{
alert("All fields must have text entered in them.");
}
}
}
var s = document.frmGetWords.allwords[4].value;
if((s.substr(s.length-1, 1)!='g')||(s.substr(s.length-2, 1)!='n')||(s.substr(s.length-3, 1)!='i'))
{
alert("A verb must end in ing");
}
if((document.frmGetWords.allwords[10].value!="Summer")&&(document.frmGetWords.allwords[10].value!="summer")&&(document.frmGetWords.allwords[10].value!="Autumn")&&(document.frmGetWords.allwords[10].value!="autumn")&&(document.frmGetWords.allwords[10].value!="Winter")&&(document.frmGetWords.allwords[10].value!="winter")&&(document.frmGetWords.allwords[10].value!="Spring")&&(document.frmGetWords.allwords[10].value!="spring"))
{
alert("It is not a valid season or if any letter beside the first letter in the season is capitalized, please change back to normal.");
}
var inputWord;
for(i=0;i<10;i++)
{
inputWord += document.frmGetWords.allwords[i].value;
}
var tempChar = "";
var isText = false;
for(i=0;i<=inputWord.length-1;i++)
{
tempChar = inputWord.charCodeAt(i);
if((tempChar > 47)&&(tempChar < 58))
{
isText = true;
}}
if(isText==true)
{
alert("Not okay, the string contains some numbers.");
}
else
{
alert("Okay, the string contains only chars.");
}
}
</script>
<FORM name=frmGetWords>
<p>Please enter your words.</p>
<table border="0">
<tr>
<td>Animal 1</td>
<td><input type="text" size="20" name="Animal"
onblur="validateField(Animal[0].value);"></td>
</tr>
<tr>
<td>Animal 2</td>
<td><input type="text" size="20" name="Animal"
onblur="validateField(Animal[1].value);"></td>
</tr>
<tr>
<td>Animal 3</td>
<td><input type="text" size="20" name="Animal"
onblur="validateField(Animal[2].value);"></td>
</tr>
<tr>
<td>Animal 4</td>
<td><input type="text" size="20" name="Animal"
onblur="validateField(Animal[3].value); "></td>
</tr>
<tr>
<td>Verb ending in 'ing' </td>
<td><input type="text" size="20" name="Verb"
onblur="validateField(Verb.value);validateSuffix(Verb.value);"></td>
</tr>
<tr>
<td>Name 1</td>
<td><input type="text" size="20" name="Name"
onblur="validateField(Name[0].value);"></td>
</tr>
<tr>
<td>Name 2</td>
<td><input type="text" size="20" name="Name"
onblur="validateField(Name[1].value);"></td>
</tr>
<tr>
<td>Machine name</td>
<td><input type="text" size="20" name="Machine"
onblur="validateField(Machine.value);"></td>
</tr>
<tr>
<td>Adjective</td>
<td><input type="text" size="20" name="MachinePart"
onblur="validateField(MachinePart.value);"></td>
</tr>
<tr>
<td>Machine part</td>
<td><input type="text" size="20" name="Adjective"
onblur="validateField(Adjective.value);"></td>
</tr>
<tr>
<td>Season of year</td>
<td><input type="text" size="20" name="Season"
onblur="validateField(Season.value);"></td>
</tr>
</table>
</FORM>
</body>
</html>
