I recomend staying away from opening another browser for popups (see DHTML
way below) but if that is what you want here is how...
In the head block of your html page put this or similar function:
function newWindow(link) {
screen_width = screen.width;
screen_height = screen.height;
window_width = 300;
window_height = 200;
positon_left =
((screen_width-window_width)/2)-((screen_width-window_width)%2);
positon_top =
((screen_height-window_height)/2)-((screen_height-window_height)%2);
window.open(link, "windowname",
"toolbar=no,scrollbars=yes,status=no,resizable=yes,menubar=no,width="+window
_width+",height="+
window_height+",left="+positon_left+",top="+positon_top);
}
The link parameter is the url to the content you want displayed in the new
window. Set the window_width and window_height variables to the desired
size for the popup window. The window will open in the center of the
monitor display. The coded settings will open a browser without a menu,
toolbar, or status bar. Configure this any way you need.
Since you mention this as a help popup, I presume you would invoke the popup
via a link. Here is a sample
<A HREF="javascript:newWindow('/help.html')">Help</A>
A slicker way to provide popups is using DHTML. This is more appropriate
when the popups need to interact with the calling page. Here is an example
(only works with Netscape, IE uses different javascript DOM to hide and show
layers which I don't know off hand):
In the head block of your html page:
<style type="text/css">
#popup {
font-family : Arial, Helvetica, sans-serif;
font-size : 12px;
position : absolute;
left : 173px;
top : 97px;
width : 270px;
height: 177px;
z-index: 1;
visibility : hide;
}
</style>
<script language="JavaScript">
function showPopup() {
document.popup.visibility='show';
}
function hidePopup() {
document.popup.visibility='hide';
}
</script>
In the body of your html page:
<div id="popup">
<table width="270" border="1" bgcolor="#CCCCCC" >
<tr>
<td align="left" valign="middle">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#000099">
<td width="95%"><b><font color="#FFFFFF">Popup</font></b></td>
<td align="right" width="5%" bgcolor="#CCCCCC"><b><a
href="javascript:hidePopup()">X</a></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="148" valign="top" align="left">This is a popup layer
embedded within the browser page.</td>
</tr>
</table>
</div>
You can then show the popup layer with a link or button, for example:
<a href="javascript:showPopup()">Show Popup</a>
If you need to support Netscape and IE, I recommend using the
DHTML/Javascript packages by Dan Steinman found at
http://www.dansteinman.com/dynduo/
Good Luck and Have Fun!
George
-----Original Message-----
From: Jonathan Silvergran, SM3OJR [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 9:21 AM
To: [EMAIL PROTECTED]
Subject: Creating popup browser windows from a servlet - how?
Importance: High
Greetings,
Perhaps this is a bit off topic on this list, but at least - it's a servlet
involved... :)
I'm working on a web application that uses servlets to create the HTML
pages.
What I'd like to achieve, is some kind of help system consisting of popup
browser windows (or Applets), preferably in a fashion that will keep the
popup windows on top even when they loose focus to the "main" browser
window. I want the main browser window (created by a servlet) to remain
intact while the new window is created in order to display other info.
If anyone could provide a code snippet or point me in a direction where I
can find more info this subject, I'd be much obliged.
TIA
/Jon
Jon, sm3ojr
European distributor of the following products:
* TR Logging Program (by N6TR)
* WJ2O Master QSO Logging Program (by WJ2O)
* RTTY (by WF1B)
---
Jonit Software, Box 178, SE-83122 OSTERSUND, Sweden
Phone: +46-63-57 21 21
Fax / 24h order: +46-63-57 21 22
Mobile: +46-70-569 21 21
E-mail: [EMAIL PROTECTED]
URL: http://www.jonit.com
ICQ: 7319834
---
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html