Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 24th, 2004, 02:51 PM
Authorized User
 
Join Date: Feb 2004
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old September 24th, 2004, 03:54 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
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 ;)
Reply With Quote
  #3 (permalink)  
Old September 25th, 2004, 10:14 AM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Reply With Quote
  #4 (permalink)  
Old September 25th, 2004, 10:21 AM
Authorized User
 
Join Date: Feb 2004
Location: , , .
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!

Reply With Quote
  #5 (permalink)  
Old September 25th, 2004, 12:03 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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
Reply With Quote
  #6 (permalink)  
Old September 27th, 2004, 03:40 AM
Authorized User
 
Join Date: Feb 2004
Location: , , .
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.



Reply With Quote
  #7 (permalink)  
Old September 27th, 2004, 11:34 AM
Authorized User
 
Join Date: Feb 2004
Location: , , .
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();
}
}

Reply With Quote
  #8 (permalink)  
Old September 27th, 2004, 01:07 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Elisabeth,

You need to declare your newwin var globally.

HTH,

Chris

Reply With Quote
  #9 (permalink)  
Old September 27th, 2004, 01:13 PM
Authorized User
 
Join Date: Feb 2004
Location: , , .
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!


Reply With Quote
  #10 (permalink)  
Old September 27th, 2004, 01:14 PM
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Restoring minimized window gbianchi Pro VB 6 2 July 11th, 2005 03: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 10:50 AM
New created popup window automatically minimized! elisabeth Javascript How-To 1 September 21st, 2004 08:20 AM



All times are GMT -4. The time now is 05:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.