Click to See Complete Forum and Search --> : ChildWindow.focus(); problems


jamesx521
07-30-2004, 11:43 PM
http://www.xn3ct.net/print

Click on the David image -- a popup window will launch; don't (click) close it.
Click on the Crossover image -- another one will launch on the top of the first one (or it will send the first popup window behind the main page).
I want to have only one pop up window at a time. And while I have a popup window open I will be able to click on another image to launch another popup window that will open on the place of the first one -- replacing it. No two popup windows at one time!
Here's the code for one of the images I have:
[/CODE] <a href="pop_TasteRestaurant01.htm" onclick="return false;" target="_blank"
onMouseDown="MM_openBrWindow('pop_TasteRestaurant01.htm','win01','width=500,height=250')">
<img src="Images/TasteRestaurant02.jpg" name="TasteRestaurant02" width="208" height="123" border="0"
id="TasteRestaurant02" ALT="Flyers design for Taste restaurant">


I was told to name all of them the same name, but that wouldn't launch any windows at all, so I gave up that idea. Here's code that I've got, but I tried different variations and didn't work:
function MM_openBrWindow(theURL,winName,features)
{ //v2.0 var ChildWindow=window.open(theURL,winName,features); ChildWindow.focus();}

Here's some extra code that experimented pasting here and there:
[CODE]; NewWindow.focus(); void(0);
body onBlur="window.focus()" ;if (newWindow.focus) {newWindow.focus()};

Thanks.

James

jamesx521
07-30-2004, 11:47 PM
This is the correction to the website address
http://www.xn3ct.net/print.htmCorrect address (http://www.xn3ct.net/print.htm)

HaganeNoKokoro
07-31-2004, 12:45 AM
This code opens the target pages in the same popup window for me (in IE6 and Detscape7.1, I dunno about other browsers)

<html>
<head>
<script type="text/javascript">
var win1;
function openWindow(url, name, attr) {
win1=window.open(url, name, attr);
win1.focus();
}
</script>
</head>

<body>
<a href="javascript: openWindow('http://www.google.ca/', 'win1', 'width=300, height=200')">Open Window</a><br/>
<a href="javascript: openWindow('http://www.ebay.ca/', 'win1', 'width=300, height=200')">Open Window</a>
</body>
</html>