0

I just want the new page to appear in an iframe on the current page instead of loading a whole new page.

Here's my code:

function salabim(id){
    var gotoo;

    var objid = document.getElementById("pgMaster");

    new Effect.Shake(id);
    return false;

    gotoo=id+".html";
    objid.src=gotoo;
    location.href(gotoo);
}

This doesn't work in any browser. What am I doing wrong?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134

6 Answers6

4

Move return false; to the end, and use location.href like so:

location.href = gotoo;
Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
2

location.href is an attribute rather than a function, use location.href = url instead.

Marcus
  • 6,701
  • 4
  • 19
  • 28
2

I think the correct syntax is:

location.href = gotoo;
Tarik
  • 2,151
  • 4
  • 19
  • 26
2

You are returning false before you do anything with location.href.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
1

You have a return false; in the middle of your function, so code after that return statement isn't executed.

kapex
  • 28,903
  • 6
  • 107
  • 121
0

use

window.location.href = "YourURL";
V.J.
  • 9,492
  • 4
  • 33
  • 49