I am a beginning programmer in Java/Javascript, and I have a situation
where I need to pull up a smaller window, without a toolbar, etc. in the
foreground. In other words, here's what I'm doing:
<A HREF="smallwindow" onClick="window2=window.open
('http://someURL/','partnerWindow','scrollbars=0,width=300, height=200')">
<IMG SRC="whatever.jpg" ALT="whatever" BORDER="0">
</A>
The problem is, when I'm doing this the window that comes up is coming in
the background behind the main window of the browser, so users cannot see
it. I have tried (well, I have shot in the dark) at several solutions, but
nothing seems to work.
Does anyone know of a way to do this?
Thanks.
Steve,
You had better make windowopen in FUNCTION.
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function smallwindow() {
window2=window.open("http://someURL/","partnerWindow","scrollbars=0,width=300,
height=200");
}
</SCRIPT>
</HEAD>
<BODY>
<A HREF="JavaScript:smallwindow();">
<IMG SRC="whatever.jpg" ALT="whatever" BORDER="0">
</A>
</BODY>
</HTML>
Cheers,
--
* Yasushi Fujita <mailto:fuj...@cij.co.jp> *
* Computer Institute of Japan, Ltd., Yokohama NT Bldg., *
* 2-24 Hiranuma 1 chome, Nishi-ku, Yokohama 220, Japan. *
* TEL +81(45)411-2571 FAX +81(45)316-8652 *
* URL http://www.cij.co.jp/ *
: I am a beginning programmer in Java/Javascript, and I have a situation
: where I need to pull up a smaller window, without a toolbar, etc. in the
: foreground. In other words, here's what I'm doing:
: <A HREF="smallwindow" onClick="window2=window.open
: ('http://someURL/','partnerWindow','scrollbars=0,width=300, height=200')">
: <IMG SRC="whatever.jpg" ALT="whatever" BORDER="0">
: </A>
: The problem is, when I'm doing this the window that comes up is coming in
: the background behind the main window of the browser, so users cannot see
: it. I have tried (well, I have shot in the dark) at several solutions, but
: nothing seems to work.
: Does anyone know of a way to do this?
: Thanks.
Well, a small bug exists whereby you could alter your line to the following:
<A HREF="smallwindow" onClick="window2=window.open
('http://someURL/','partnerWindow','scrollbars=0,width=300,height=200');
window2.focus())">
It only works in Netscape though - MSIE won't work and generates an error
message regarding 'focus()' not being a function of a window.
Richard Dows, mar...@randomc.com
Try this:
<SCRIPT LANGUAGE="Javascript">
<!--
function GetRoot()
{
curHref = self.location.href;
lastSlash = curHref.lastIndexOf( "/");
return curHref.substring( 0, lastSlash + 1);
}
function OpenPartnerWindow()
{
w = 300;
h = 200;
r = 0;
file = "Partner.html";
newWindow = open( "", "partnerWindow", "resizable=" + r + ",width=" + w
+ ",height=" + h);
newWindow.location.href = GetRoot() + file;
}
// -->
</SCRIPT>
<A HREF="javascript:OpenPartnerWindow()"
onMouseOver="window.status='Open Partner Window'; return true">
<IMG SRC="whatever.jpg" ALT="whatever" BORDER="0"></A>
If the window stays behind the current window it's because it's already
open. The partnerWindow will come to the front the first time it is
opened, but not subsequent times unless focus is given to it in the
script.
--
Mike Davis
Chief Technology Officer
Glass Bead New Media
503.295.0680
http://www.glassbeadinc.com/
ad...@network13.net
and webmaster of these fine sites:
http://www.network13.net/
http://www.art-link.com/
http://www.webracadabra.com/
http://www.localsonline.com/
http://www.generationxfiles.com/