Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts

    location.href syntax problem

    This works fine:

    // Function to save cookie and jump to note page
    function noteJump(){
    saveCookie1y("noteCookie",0,X1y);
    location.href='note.html';
    }

    But I'm jumping from a frames page to an non-frames page and it's creating a problem. Here's what I need to do but the syntax is illegal. Just the last line is different:

    // Function to save cookie and jump to note page
    function noteJump(){
    saveCookie1y("noteCookie",0,X1y);
    location.href='note.html' target='_top';
    }

    I also tried:

    location.href('note.html' target='_top');

    My !#*&% books are always written for people that have programming training. I just wish they gave examples of actual coding because it's always a ; or : or something like that that hangs me up.

    Thanks!

    P.S.

    Perhaps there is another way to do this? Click on a link and have a cookie written before jumping to the link?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try:

    top._top.location.replace("nextsite.htm")

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I didn't get an error message when the page came up, but when I clicked on the link and it called the function I got:

    Error: 'top._top.location' is null or not an object

  • #4
    New Coder
    Join Date
    Nov 2002
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just call the frame name like this, not sure what it is...


    targetframename.location.href='';
    » ð, Ŵħąŧ¿ Ýőų łįķę¿

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    Bonny Scotland! Status: Insane
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    parent._top.location.href="note.html"
    should work
    «Ðå G壣ꮻ²ºº²

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I tried:

    targetframename.location.href='faqs_fast.html';

    When the function is called I get the error message:

    'targetframename' is undefined

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I tried:

    parent._top.location.href="note.html";

    When the function was called I got the error message:

    Error: 'parent._top.location' is null or not an object

  • #8
    New Coder
    Join Date
    Jun 2002
    Location
    Bonny Scotland! Status: Insane
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ahh, re-reading question:
    top.location.href="note.html";
    should work....
    «Ðå G壣ꮻ²ºº²

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks dagaffer!

    after

    parent._top.location.href='note.html';

    failed I got an idea and tried

    parent.location.href='note.html';

    and it worked fine. But it was just a guess and I'm not sure of it so I'll go with your last recommendation which also works fine:

    top.location.href='note.html';

    I just can't get this stuff out of books!

  • #10
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Frames could be nested in each other. That means using a framed page inside another framed page and going as deep as you want! So, by saying top. you mean going back to the very first page ( the grand grand father! ). But by using parent you just go one level back. Hope that it helped!

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I suspected that though I have never gone that deep. But that's why I chose to use top.

    Thanks for the post to help others that follow... should there EVER be anyone that codes as I do!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •