<script>
function getit() {

var stats = document.former.stats.value;
var info = document.former.info.value;
var command = document.former.command.value;
var x = document.former.info.value;
var gotkey = "0";


if (command == "get key" && gotkey == "0") {getkey()}

else if (command == "get key" && gotkey == "1") {getkey1()}
else {
document.former.info.value=x +"\n Invalid Command"}

function getkey() {
var stats = document.former.stats.value;
var info = document.former.info.value;
var command = document.former.command.value;
var x = document.former.info.value;
var gotkey = "1";
{document.former.info.value=x + "\n You got the key"}
}
function getkey1() {
document.former.info.value=x +"\n You already have the key"
}
}
</script>

<form name="former">
<input type="textarea" name="stats" value="You are in a room. There is a key on the desk near you." size="84" onFocus="alert('You cannot edit this section!')">
<p>
<textarea rows="12" name="info" cols="52" onFocus="alert('You cannot edit this section!')"></textarea>
</p>
<p>
<input type="text" name="command" size="20">
</p>
<p>
<input type="button" value="Submit" onClick="getit()" name="B2">
</form></p>