logo
Ryan's Webpage
 

Mad Lib

Please enter the following information

A person's name
A silly sound
A body part
A vehicle
A type of animal

<html>
<head>
<script>
function makeML(){
// by Ryan Te
// 10/26/07
// makes a silly story from a bunch of input terms

//get variables from form
var person = window.document.myForm.txtPerson.value;
var sound = document.myForm.txtSound.value;
var part = document.myForm.txtPart.value;
var vehicle = document.myForm.txtVehicle.value;
var animal = document.myForm.txtAnimal.value;
var story = "";

story = "One day, a person named " ;
story += person;
story += " was walking down the street. Suddenly, ";
story += person;
story += " heard an awful ";
story += sound;
story += " sound. ";
story += person;
story += " looked around and saw that the ";
story += sound;
story += " sound was coming from a ";
story += vehicle;
story += " careening madly down the street. ";
story += person;
story += "'s fear turned to terror as "
story += person;
story += " realized that the ";
story += vehicle;
story += " was driven by none other than the evil Super-";
story += animal;
story += ". Once an ordinary ";
story += animal;
story += ", it had befallen a strange transformation after ";
story += "being dropped in a vat of nuclear waste. ";
story += "Super-"
story += animal;
story += " continued to taunt ";
story += person
story += " with the horrible ";
story += sound;
story += " noise, but ";
story += person;
story += " was unconcerned. \"You can't bother me, Super-";
story += animal;
story += "! I know how to turn the other " ;
story += part;
story += "!\" \nThe End."

document.myForm.txtStory.value = story;
} // function end MakeMl
</script>
</head>
<body>
<center>
<h1>Mad Lib<hr></h1>
<form name = myForm>
<h3>Please enter the following information</h3>
<table border = 1>

<tr>
<td>A person's name</td>
<td><input type = text name = txtPerson></td>
</tr>

<tr>
<td>A silly sound</td>
<td><input type = text name = txtSound></td>
</tr>

<tr>
<td>A body part</td>
<td><input type = text name = txtPart></td>
</tr>

<tr>
<td>A vehicle</td>
<td><input type = text name = txtVehicle></td>
</tr>

<tr>
<td>A type of animal</td>
<td><input type = text name = txtAnimal></td>
</tr>

<tr>
<td colspan = 2><center>
<input type = "button"
value = "Click for story"
onClick = makeML()>
</td>
</tr>

</table>

<textarea name = txtStory
rows = 10
cols = 40
wrap>
</textarea>

</form>
</center>

<hr>
</body>
</html>

 

 

Contact Me

 

Mr. Styner's Webpage

 

Peter

Julie

Nick

Tiddus

Norman