this is what I need to do:
As you will notice the quiz/quiz_basic.htm is the same quiz for every site. This is where I think the code should be. I have about 50 site like this and I would like to have the quiz itself in only one place instead of 50 places. By the way I'm not use to work with javascript.
This is my actual code:
<HEAD>
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- 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) {
self.location="
}
else {
alert("You cannot receive your certificate unless you score "+10+" points.")
}
}
// End -->
</SCRIPT>
<title>Quiz - Junior</title>
<style type="text/css">
<!--
@import url("../fhhweb_body.css");
-->
</style>
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../fhhweb_body.css" rel="stylesheet" type="text/css">
</head>
Thanks
As you will notice the quiz/quiz_basic.htm is the same quiz for every site. This is where I think the code should be. I have about 50 site like this and I would like to have the quiz itself in only one place instead of 50 places. By the way I'm not use to work with javascript.
This is my actual code:
<HEAD>
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- 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) {
self.location="
}
else {
alert("You cannot receive your certificate unless you score "+10+" points.")
}
}
// End -->
</SCRIPT>
<title>Quiz - Junior</title>
<style type="text/css">
<!--
@import url("../fhhweb_body.css");
-->
</style>
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../fhhweb_body.css" rel="stylesheet" type="text/css">
</head>
Thanks