Lesson 45: The Script and Its Effect



The Script

<SCRIPT LANGUAGE="javascript">

function Balboa()
{
var num = document.RockyForm.RockyUser.value

var Movie = new Array(6)
Movie[0]="There was no Rocky 0"
Movie[1]="Rocky"
Movie[2]="Rocky II"
Movie[3]="Rocky III"
Movie[4]="Rocky IV"
Movie[5]="Rocky V"

var Outcome = new Array(6)
Outcome[0]="No Outcome"
Outcome[1]="Rocky Loses"
Outcome[2]="Rocky Wins"
Outcome[3]="Rocky Loses, then Wins"
Outcome[4]="Apollo Dies, Rocky Wins"
Outcome[5]="Rocky Wins Street Brawl"

document.RockyForm.RockyTitle.value=Movie[num]

document.RockyForm.RockyOutcome.value=Outcome[num]

}

</SCRIPT>

<FORM NAME="RockyForm">Enter a Rocky Movie Number (1-5):
<INPUT NAME="RockyUser" TYPE="text" SIZE="2">

<INPUT TYPE="button" Value="Tell Me What Happens" onClick="Balboa()"><P>

You chose: <INPUT NAME="RockyTitle" TYPE="text" SIZE="26"><BR>
The outcome was: <INPUT NAME="RockyOutcome" TYPE="text" SIZE="26">
</FORM>

 

The Script's Effect

Enter a Rocky Movie Number (1-5):

You chose:
The outcome was:

 

Back to the Index Page