|
I'm in a Frameset, and the Next and Previous buttons are not in the same frame as my test question. The Next button's function sits on a .js page. Could you tell me how to call it? Just inserting function navigateNext(); didn't work. Seeing that it gets called in a different frame, can I override it and push the user to the next page from within my main body frame? Apologies for the inexperience here.
The Next button's code looks like this, fwiw:
function navigateNext()
{
var topicNameLayer='';
var nextPage = "";
var documentLocation = "" + parent.contentFrame.document.location + "";
moduleNoArray = eval("module" + parent.moduleNo + "Array");
moduleNoPos = documentLocation.indexOf("module_");
topicNoPos = documentLocation.indexOf("topic_");
screenNoPos = topicNoPos + 18;
if ((moduleNoPos > -1) && (topicNoPos > -1) && (screenNoPos > -1))
{
moduleNoString = documentLocation.substring((moduleNoPos + 7), (moduleNoPos + 9));
topicNoString = documentLocation.substring((topicNoPos + 6), (topicNoPos + 8));
moduleNo = parseInt(moduleNoString, 10);
topicNo = parseInt(topicNoString, 10);
pageNo = parseInt(documentLocation.substring((screenNoPos), (screenNoPos + 2)), 10);
if (pageNo < moduleNoArray[topicNo][1])
{
pageNo++;
if (pageNo < 10)
{
nextPage = "module_" + moduleNoString + "/topic_" + topicNoString + "/m" + moduleNoString + "_t" + topicNoString + "_p0" + pageNo + ".htm";
}
else
{
nextPage = "module_" + moduleNoString + "/topic_" + topicNoString + "/m" + moduleNoString + "_t" + topicNoString + "_p" + pageNo + ".htm";
}
}
else
{
if ((topicNo + 1) >= moduleNoArray.length)
{
if ((moduleNo + 1) > parent.maxModules)
{
alert("You have reached the last page of this course.");
return;
}
else
{
// Moving to the next module.
moduleNo++;
parent.moduleNo = moduleNo;
moduleNoArray = eval("module" + parent.moduleNo + "Array");
// Updating the list of topics for the next module.
//displayTopics();
topicNo = 0;
pageNo = 1;
parent.currentTopicNo = topicNo;
if (moduleNo < 10)
{
nextPage = "module_0" + moduleNo + "/topic_0" + topicNo + "/m0" + moduleNo + "_t0" + topicNo + "_p0" + pageNo + ".htm";
}
else
{
nextPage = "module_" + moduleNo + "/topic_0" + topicNo + "/m0" + moduleNo + "_t0" + topicNo + "_p0" + pageNo + ".htm";
}
// REMEMBER
//parent.topFrame.topicName.innerHTML = moduleNoArray[topicNo][0];
}
}
else
{
// Moving to the next topic within the current module
topicNo++;
pageNo = 1;
parent.currentTopicNo = topicNo;
if (topicNo < 10)
{
nextPage = "module_" + moduleNoString + "/topic_0" + topicNo + "/m" + moduleNoString + "_t0" + topicNo + "_p0" + pageNo + ".htm";
}
else
{
nextPage = "module_" + moduleNoString + "/topic_" + topicNo + "/m" + moduleNoString + "_t" + topicNo + "_p0" + pageNo + ".htm";
}
// Change the Topic name in the top band
// REMEMBER
//parent.topFrame.topicName.innerHTML = moduleNoArray[topicNo][0];
}
}
// Jump to the next page
parent.contentFrame.document.location = nextPage;
}
}
Thanks for helping.
|