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 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2003
    Location
    around, here and there, like gypsy
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Links that jump around

    I had an earlier question answered about how to change two iframes with one click of a link. Now, my iframes respond when I invoke them, but with this code I'm using ---

    <a onclick="window.open('DrMenu.htm','menu') ; window.open('BioStaff.htm','contents')" href="#">One Link to Change Them ALL!!!</a>

    clicking the link sends my entire page (not the iframes, but the page they are embedded on) to it's very bottom (like hitting the End button in a Word document). Granted, it's not a tall page and it doesn't have a long way to go, but it is jarring, and I do not want to injure my users.

    Why is this happening? If you know how to fix it, would you?

    Thanks, everyone.

    Have a great mini.

    Boot.
    Hey, that's all I'm saying.

  • #2
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <a onclick="window.open('DrMenu.htm','menu') ; window.open('BioStaff.htm','contents') ; return false;" href="#">One Link to Change Them ALL!!!</ a>

    should do ya

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    or

    <a href="javascript:window.open('DrMenu.htm','menu') ; window.open('BioStaff.htm','contents'); return true">One Link to Change Them ALL!!!</a>
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    New Coder
    Join Date
    Jul 2003
    Location
    around, here and there, like gypsy
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A thanks to both repliants

    Yeah, this worked fine, but if you have time, could you explain exactly what return false/true does?
    Hey, that's all I'm saying.

  • #5
    Regular Coder
    Join Date
    Apr 2003
    Location
    Atlanta, GA
    Posts
    487
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When you return false in an event handler <a onclick="return false">), you essentially cancel that event, making it look to the normal execution of the page as though nothing happened.

    When you return true in a javascript URL (<a href="javascript:blah();return true;">), essentially you're doing nothing. By default, event handlers return true, unless they cancel themselves during execution (possible, but rarely seen) using event.stopPropogation() or event.returnValue = false; or something along those lines.


    The value returned at the end of an event handler is essentially a flag as to whether the page should act as though anything happened outside the script that has already executed.

    HTH.


  •  

    Posting Permissions

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