What did i do wrong?


#1

I am making a .hta game and I have asked on many websites for help but nothing. when I run this script I get a undefined error so please help.

<application>
<head>
<title>Sample game</title>
</head>
<body>
<h1>Hello and welcome to the death tbg(text-based-game) just answer each          question and see what you get!</h1>
<div id="question"></div>
<div id="answers"></div>
<embed src="expl.mp3" autostart="true" loop="true"
width="2" height="0">
</embed>
<script>
var db = [
{	//0
    "question":"You wake up in a dark room no light all but faint shadows    dancing around the room. As you move around trying to find your way you find    a switch what do you do?",
    "answers":[
        {"title":"Turn it on","response":1},
        {"title":"Panic, but remain still","response":2},
        {"title":"Scream","response":3},
        {"title":"Run like mad","response":4},
        ]
},
{	//1
    "question":"KABOOM!!! Just kidding all you see is a cage a knife and a dead body.",
    "answers":[
        {"title":"A DEAD BODY?!?!?!","response":5},
		{"title":"noice","response":6},
		{"title":"Check to see who it is like a real detective","response":7},
        ]
},
{	//2
    "question":"Why did you panic you scrub.",
    "answers":[
        {"title":"You better know the key to speed(SPEEED IS KEEEEEEEEEEEEEEEY!!!!!!)","response":8},
        {"title":"Well not much to say really.","response":9},
		{"title":"You get humiliated. You try to run but you trip and die.","response":10},
		]
},
{	//3
    "question":"Nice Scream. Now what",
    "answers":[
        {"title":"You screamed. No one is there. No one can save you.","response":11},
        {"title":"Your such a wimp.","response":12},
        ]
},
{	//4
    "question":"You run into a killer.",
    "answers":[
        {"title":"Go ham","response":13},
		{"title":"Dance","response":14},
		{"title":"kill him??","response":15},
        ]
},
{	//14
    "question":"You try to kill him",
    "answers":[
        {"title":"Gouge ","response":16},
		{"title":"","response":17},
		{"title":"","response":18},
        ]
}
];

var currentLocation = 0;

window.printCurrentLocation = function(){
   document.getElementById("question").innerHTML =         db[currentLocation].question;
var answers = "";
for(var i=0,l=db[currentLocation].answers.length;i<l;i++){
    answers += "<p><button       onclick='setLocation("+db[currentLocation].answers[i].response+")'>"+db[curre   ntLocation].answers[i].title+"</button></p>";
}
document.getElementById("answers").innerHTML = answers;
}

window.setLocation = function(num) {
currentLocation = num;
window.printCurrentLocation();
}

window.printCurrentLocation();

</script>
</body>
</application>

#2

@11morgan11 Cussing isn't allowed on these forums, please read through the forum guidelines. I've edited your post for you this time.