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 6 of 6

Thread: Location Syntax

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Location Syntax

    I tried my books and searching this site and gave up so I have to ask this really novice question.

    I had a graphic on my page as an href link to another page, but before jumping to the new page I want to write a cookie. So I changed the href to call a function, but can't figure out the syntax to then jump to the new page.

    function WriteCookieGoToNewPage(){
    saveCookie... this line works fine
    location.'pageName.html' target='_top'}

    I get the error messages Expected Identifier and Object Expected.

    Thanks!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try location.href

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    If you mean:

    location.href.'pageName.html'

    instead of:

    location.'pageName.html'

    I still got the same errors.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    location.href = 'pageName.html'

    It might need to be like this, I'm not sure

    window.location.href = 'pageName.html'

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    It's working now, thanks:

    location.href='pageName.html';

    though it didn't like target='_top' added on to the end.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

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