View Full Version : Links that jump around

Boot Weasel
07-16-2003, 01:16 AM
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.


07-16-2003, 02:49 PM
<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

07-16-2003, 02:56 PM

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

Boot Weasel
07-16-2003, 05:06 PM
Yeah, this worked fine, but if you have time, could you explain exactly what return false/true does?

07-16-2003, 05:15 PM
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.