Results 1 to 6 of 6

Thread: "#blabla", how to take them off the url?

  1. #1
    Join Date
    Dec 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "#blabla", how to take them off the url?

    Here's my problem:

    I got a top page with two iframes in it. The 1st iframe is iframe1.html and the 2nd iframe2.html. The top page is index.html.
    I click on a button in iframe2.html that goes to an ID named "blabla" in the 1st iframe (iframe1.html), so the link is "#blabla".
    After that I want to go to an another ID in iframe1.html (through iframe2.html). That link is "#bleble", but the the 1st iframe's location is "iframe1.html#blabla", so it won't take me t "bleble", becayse then the link would be "iframe1.html#blabla#bleble".

    I'm using this javascript codes as links right now (which doesn't work the second time i want to go to an ID):
    Code:
    parent.iframe1.location = parent.iframe1.location + '#blabla';
    
    and
    
    parent.iframe1.location = parent.iframe1.location + '#bleble';
    So the thing is that I want to know if there's any code that takes off/deletes the old ID from the 1st iframe's url/location...
    Any thoughts?
    Last edited by bladefinor; 12-15-2008 at 03:20 PM.

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Have you tried:
    HTML Code:
    parent.iframe1.location = parent.iframe1.location.split('#')[0] + '#blabla';
    parent.iframe1.location = parent.iframe1.location.split('#')[0] + '#bleble';
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Dec 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    now i tried, and that didn't work. nothing happened :/

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That looks like it should work, perhaps you copied it incorrectly. Though, to be on the safe side, one should use the href property:

    Code:
    parent.iframe1.location.href = parent.iframe1.location.href.split('#')[0] + '#blabla';
    parent.iframe1.location.href = parent.iframe1.location.href.split('#')[0] + '#bleble';
    But what's wrong with:

    Code:
    parent.iframe1.location.href = 'iframe1.html#blabla';
    parent.iframe1.location.href = 'iframe1.html#bleble';
    ??

    If you want more help:

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2008
    Location
    Nigeria
    Posts
    95
    Thanks
    3
    Thanked 8 Times in 8 Posts

    Default

    Have u tried parent.iframe1.location.hash as oppose to parent.iframe1.location.href .
    If that doesnt work, let me know, i will lookup my old projects, i have something like that somewhere that works after alot of headache especially from fd

  6. #6
    Join Date
    Dec 2008
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    That looks like it should work, perhaps you copied it incorrectly. Though, to be on the safe side, one should use the href property:

    Code:
    parent.iframe1.location.href = parent.iframe1.location.href.split('#')[0] + '#blabla';
    parent.iframe1.location.href = parent.iframe1.location.href.split('#')[0] + '#bleble';
    But what's wrong with:

    Code:
    parent.iframe1.location.href = 'iframe1.html#blabla';
    parent.iframe1.location.href = 'iframe1.html#bleble';
    ??

    If you want more help:

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    thx, it works perfect

    the other codes you asked why i don't use them s becuase it's not online one page in iframe1, i have other pages there too which uses the same code to "scroll"

Bookmarks

Posting Permissions

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