PDA

View Full Version : Open links in new window



hask23
08-10-2006, 09:18 AM
1) Script Title: Open links in new window

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/newwindow.htm

3) Describe problem: I have two questions. 1. How can I get rid of the check box, I just want the links to automatically open in a new window. 2. I'm trying to open all links in the same new window. This worked fine until I added a jump menu. The jump menu opens the links in the same page.

Thanks Matt

jscheuer1
08-10-2006, 10:02 AM
1 ) Delete the checkbox from the page and get rid of the red part in this function:


function inithyperlinks(){ //DynamicDrive.com added routine
if (document.targetform.targetnew.checked)
hyperlinks(true)
}

2 ) Edit the jump menu to open links in the same new window. To help more on this part, I would need to see your jump menu (its script and possibly its markup as well). A link to your live page would be fine as long as the code I need to see is on or linked to it.

hask23
08-10-2006, 08:56 PM
Thanks for the help on the first question, it worked great. Here's a link to a page with some jump menus, http://affiliates.vilasonline.org/kindergarten/kg_week_1.htm.

Matt

jscheuer1
08-10-2006, 09:33 PM
Find this function:


function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

Change it to:


function MM_jumpMenu(targ,selObj,restore){ //v3.0
var thewin=window.open(selObj.options[selObj.selectedIndex].value,targ);
thewin.focus();
if (restore) selObj.selectedIndex=0;
}


Make your onchange events look like so:


onchange="MM_jumpMenu('window2',this,0)"

hask23
08-10-2006, 10:31 PM
Works great...thank you very much for the help.

Matt