Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 24th, 2004, 01:51 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default Popup window automatically minimized on click!

Hello,
I have a popupwindow defined as followed:

function popupPage(prgName)
{
windowprops = "height=300,width=450,location=no,"
+ "scrollbars=no,menubars=no,toolbars=no,resizable=n o, menubar=no";
window.open(prgName, 'popUp', windowprops);
}

 I call this function through a button the following way:
   <input onclick="popupPage('listServ.jsp')" type=button tabindex=2 value="List services">

Now, the first time I click on the button, the popup page appears.
But if I click a second time on the same button, the popup page is automatically minimized!!.

Could anyone suggest something?

Thanks
ELisabeth

 
Old September 24th, 2004, 02:54 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Change your function like this:

function popupPage(prgName)
{
    var newwin = window.open(prgName, 'popUp',"height=300,width=450,location=no,scrollba rs=no,menubars=no,toolbars=no,resizable=no, menubar=no");
 newwin.focus();
}

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)
 
Old September 25th, 2004, 09:14 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you.... you are the best!!!


 
Old September 25th, 2004, 09:21 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually, there is something now which is not working and was working previously!
The window is not automatically closed!!!
After the focus() order, I put the following line:
setTimeout('newwin.close()', 60000); .... but it does not seem to do anything!

 
Old September 25th, 2004, 11:03 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Do you really want it to close after one minute (60000/1000/60)?

--

Joe
 
Old September 27th, 2004, 02:40 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am generating help window for fields. Each field has its own help window. Now, I would like the window to close automatically after one minute or so (I think one minute is enough to read a few lines).
I don't want the window to hang around forever.



 
Old September 27th, 2004, 10:34 AM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So, do you know why my window can not close automatically?
Here is the entire coding:

function explain(msg)
{
var newwin = window.open('', 'popUp',"top=150,left=150,height=110,width=325,loc a
tion=no,scrollbars=no,menubars=no,toolbars=no,resi zable=no, menubar=no");
newwin.focus();
setTimeout('newwin.close()', 30000);
if (!newwin.opener) newwin.opener = self;
with (newwin.document)
{
open();
write('<html>');
write('<body onLoad="document.form.box.focus()"><form name=form>' + msg + '<br>'
);
write('<p><center><input type=button value="Cerrar ventana" onClick=window.close
()>');
write('</center></form></body></html>');
close();
}
}

 
Old September 27th, 2004, 12:07 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Elisabeth,

You need to declare your newwin var globally.

HTH,

Chris

 
Old September 27th, 2004, 12:13 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, I put the following line just after <script language="JavaScript">
var newwin;

Now, in my script, I did this;

function explain(msg)
{
newwin = window.open <===== INSTEAD OF VAR NEWWIN('', 'popUp',"top=150,left=150,height=110,width=325,loc ation
=no,scrollbars=no,menubars=no,toolbars=no,resizabl e=no, menubar=no");
newwin.focus();
setTimeout('newwin.close()', 30000);
.....

It still does not work!


 
Old September 27th, 2004, 12:14 PM
Authorized User
 
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, it worked!!! ... COuld you explain why??







Similar Threads
Thread Thread Starter Forum Replies Last Post
Restoring minimized window gbianchi Pro VB 6 2 July 11th, 2005 02:23 PM
alerting popup windown in minimized form sirsyme Javascript How-To 4 February 4th, 2005 06:04 AM
how to blink the minimized window vickyj Classic ASP Basics 0 January 25th, 2005 07:18 AM
showing a popup window on click widad Classic ASP Basics 4 October 15th, 2004 09:50 AM
New created popup window automatically minimized! elisabeth Javascript How-To 1 September 21st, 2004 07:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.