Well, here is where the the 'opening' and targeting currently take place:
Code:
if (addr) parent.location.href=addr
This will actually open the the link in the parent window (if using frames and the script is in a frame, this means the top level frameset will be replaced - if there is no frameset, it just means the current window. It really should read just:
Code:
if (addr) location.href=addr
Now, we can target, let's change it to:
Code:
if (targ&&targ!=='_blank')
targ.location.href=addr
else if (targ&&targ=='_blank')
window.open(addr)
else if (addr) location.href=addr
We also need to allow for and pass the new 'targ' variable, so where it says:
Code:
function SwitchMenu(obj, addr){
add to it like this:
Code:
function SwitchMenu(obj, addr, targ){
Finally, when we call this use:
Code:
onclick="SwitchMenu(0, './test2.html', '_blank')"
or:
Code:
onclick="SwitchMenu(0, './test2.html', 'main')"
Bookmarks