logo
Ryan's Webpage
 

Mad Lib

Please enter the following information

Your name
Wierd sound
Dream Car

<html>
<head>
<script>
function makeML(){
// by Ryan Te
// 10/28/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 story = "";

story = "One day, a person named " ;
story += person;
story += " won a dream car. ";
story += "The dream car was a ";
story += part;
story += ". ";
story += person;
story += " drove the "
story += part;
story += ". "
story += "Then all of a sudden it made a wierd sound. ";
story += "The sound was a ";
story += sound;
story += " sound."
story += "The ";
story += sound;
story += " sound came from the "
story += part;
story += "'s engine."
story += "Then the "
story += part;
story += " exploded."
story += "The 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>Your name</td>
<td><input type = text name = txtPerson></td>
</tr>

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

<tr>
<td>Dream Car</td>
<td><input type = text name = txtPart></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