PDA

View Full Version : Load a different page


rhyspaterson
11-22-2007, 03:51 AM
Hey guys,

My pseudo code (which works) as below:


var dController = {

state : 'block'

block : function() {
*/
* code
/*
}
,

authenticate : function() {
*/
* Code
/*
}
,

coach : function() {
*/
* Code
/*
}
,

if (document.getElementById) {
addEvent(window, 'load', dController[dController.state]);
}


How could i tell my addEvent handler to load a different page that the script was called from? I.e block.html calls the script, but the state variable gets set to authenticate, so i run the authenticate function (all of this works so far) - but then instead of loading block.html, i want to load authenticate.html (because the authenticate function was called). Obviously i will have to set this somewhere in the authenticate function but i don't really know how to go about it. Any suggestions?

Cheers :D

ChiefWigs1982
11-24-2007, 12:11 PM
Could you just do a window.location.replace("whatever.html"); in
each of the dController's functions.