I'm trying to get the values out of an array. If the value in the array equals false, it will redirect the page to a new window. However, the dialogBehavior() function will not work. Does anyone know what the problem is? Is there an error in the syntax?
var byLawsToken = false;
var meetingSummaryToken = false;
var directoryToken = false;
var tokenArray = new Array(3);
tokenArray[0] = byLawsToken;
tokenArray[1] = meetingSummaryToken;
tokenArray[2] = directoryToken;
var windowLocation = new Array(3);
windowLocation[0] = "bylaws.html";
windowLocation[1] = "index.html";
windowLocation[2] = "about.html";
function dialogBehavior()
{
var hashedPassword = "6909b1c8fa84hd98b1f25aa1a4bccc23";
var hashedInput = CryptoJS.MD5($("#passwordTXT").val()).toString();
if(hashedInput == hashedPassword)
{
// The part I'm having trouble with
for(var i = 0; i < tokenArray.length; i++)
{
if(tokenArray[i].get() == true)
{
window.location.href = windowLocation[i];
break;
}
}
}
else
{
$("#error").show();
$("#passwordTXT").val("")
}
}
function throwByLawsToken()
{
byLawsToken = true;
}
function throwMeetingSummaryToken()
{
meetingSummaryToken = true;
}
function throwDirectoryToken()
{
directoryToken = true;
}
function resetTokens()
{
var byLawsToken = false;
var meetingSummaryToken = false;
var directoryToken = false;
}
function hideDialog()
{
$("#error").hide();
$("#passwordTXT").val("")
}
function writeDate()
{
document.write(new Date().getFullYear());
}