SWAT My Welcome Of Doom to you!!!
  Javascript Actionscript Blog
Mad Lib#1 Mad Lib

Please enter the following information

A person's name
A hilarious sound
A body part
A vehicle
A type of animal
  <script>
function makeML() {
// Mad Lib
// David Fang 10/07
// make a silly story from a bunch of input terms
//get variable 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 trnasformation 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;
</script>
Mad Lib#1
<hl>Mad Lib<hr></hl>
<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 hilarious sound</td>
<td><input type=textname=txtSound/></td>
</tr>
<tr>
<td>A body part</td>
<td><input type=textname=txtPart/></td>
</tr>
<tr>
<td>A vehicle</td>
<td><input type=textname=textVehicle/></td>
</tr>
<tr>
<td>A type of animal</td>
<td><input type=textname=txtAnimal/></td>
</tr>
<tr>
<td colspan=2><center>
<input type=button
value="click for story"
onClick=makeML()>
</td>
</tr>
<textarea name=txtStory
rows=10
cols=40
wrap>
</textarea>

Links

1. SLHS

2. SLHSXC

3. JMMS

Contact me

Class links

Computer Science

Five Classmates

1. Julio Maravilla

2. Norman Duong

3. Huy Vo

4. Titus Green

5. Jack Li

 
 
 
 
 
 
 
 
Home Product Contact order