Frame location change bug

384 Views Asked by At

I have successfully changed the location of frames on my page using commands like:

parent.bottomframe.location = 'interstitial.html';.

This one particular call, however, isn't working. I am calling a js function from the 'onclick' of a button in html. This function does most of its work successfully, and also successfully changes the text of my top frame using

parent.topframe.document.getElementById("tutorial").innerHTML = text;

But the bottom frame doesn't change. Could it be that I'm losing permission to change this property? If I put an alert() after the location-change line, I get back the old location, not the new one.

Any ideas?

(Here's the code for this function:)

function GetInterstitial(found_target)
{
parent.topframe.current_trial++;

if (found_target)
{
    parent.topframe.correct++;
}
if (parent.topframe.current_trial==parent.topframe.total_trials)
{
    UpdateData(parent.topframe.output);
    setTimeout(function()
        {SendAllData();}, 0
        );
    parent.topframe.document.getElementById("tutorial").innerHTML = thank_you_text[0]+parent.topframe.correct.toString()+'/'+parent.topframe.total_trials.toString()+thank_you_text[1];
    parent.bottomframe.location.href = 'http://urlname..../js/thankyou.html?c='+parent.topframe.userID;
}
else
{
    if (found_target)
        text = "<p>Great job; you found the hidden number! Now click 'next' to play the next round.</p>";
    else
        text = "<p>Hmm... it seems you didn't find the hidden number. Click 'next' to play the next round.</p>";
}

setTimeout(function()
    {
        UpdateData(parent.topframe.output);
    },600);

parent.topframe.document.getElementById("tutorial").innerHTML = text; //interstitial_text;
parent.bottomframe.location = 'interstitial.html';
parent.topframe.trial++;
parent.topframe.document.getElementById("nextbutton").style.display="block";
}
0

There are 0 best solutions below