Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]SWITCH LOCATION[/b]

Status
Not open for further replies.

melstef

Programmer
Feb 19, 2003
69
0
0
CA
Someone told me to do a switch location but I'm not sure if my code is correct.
I am at this address when I click on quiz it goes here
Here is my problem: After clicking on get certificate, I need to go back to the root :
here is the code I have:(look at the end, next level)

thanks

<SCRIPT LANGUAGE="JavaScript1.1">

<!-- Begin
var ans = new Array;
var done = new Array;
done[1] = false;
done[2] = false;
done[3] = false;
done[4] = false;
done[5] = false;
done[6] = false;
done[7] = false;
done[8] = false;
done[9] = false;
done[10] = false;


var score = 0;
ans[1] = "c";
ans[2] = "a";
ans[3] = "c";
ans[4] = "c";
ans[5] = "c";
ans[6] = "a";
ans[7] = "b";
ans[8] = "d";
ans[9] = "b";
ans[10] = "b";



function Engine(question, answer)
{
if (answer != ans[question])
{
if (done[question] == false)
{
alert("Nope. Your score stays at " + score+" points.");
}
else
{
alert("You have already answered this one.");
document.getElementById("quest"+question+"-"+ans[question]).checked = true;
}
//if(done[question] && )
/*else
{
alert("You have already answered this one.");
}*/
}

else
{
if (done[question] == false)
{
done[question] = true;
score++;
alert("Yes! Your score is now " + score+" points.");
}

else
{
alert("You have already answered this one.");
}
}
}

function NextLevel () {
if (score > 10) {
alert("You cheated.");
}
if (score >= 10 && score <= 10) {
var loc = 'quizinfo.htm';
switch (location) {
case 'abfco':
window.location = 'abfco/' + loc;
break;
case 'test':
window.location = 'test/' + loc;
break;
case 'test3':
window.location = 'test3/' + loc;
break;
}
self.location = loc;


}
else {
alert("You cannot receive your certificate unless you score "+10+" points.")
}
}
// End -->
</SCRIPT>
 
Pass the name of the target directoty through the URL. See faq216-5442.

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top