Click to See Complete Forum and Search --> : Open new window


John K
05-09-2003, 11:14 PM
I cannot seem to open a pop-up window. The link is in the form of a javascript. It just doesn't work.
I am using the following script in the head of the document I want to open;

<SCRIPT LANGUAGE="JavaScript">
<!--


//Enter "_blank" for new window (each time), "window2" for a set secondary window
var newwindow="_blank"

function hyperlinks(target){
if (target) where = newwindow;
else where = "_self";
for (var i=0; i<=(document.links.length-1); i++){
if (target && where!="_blank")
document.links[i].onclick=function(){
if (window.window2 && !window2.closed)
window2.location=this.href
else
window2=window.open(this.href)
window2.focus()
return false
}
else{
if (newwindow=="window2") document.links[i].onclick = "";
document.links[i].target = where;
}
}
}

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

window.onload=inithyperlinks

// -->
</SCRIPT>

A1ien51
05-10-2003, 12:11 AM
Well looks to me you need acheckbox to be checked in order to open a new window. Did you get the whle code from dynaic drive??

You may jyst want to look at this, unless you eally need to use that script

http://www10.brinkster.com/A1ien51/scripts/PopUpWinGenV3.htm