 |
| 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
|
|
|
|

September 24th, 2004, 01:51 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

September 24th, 2004, 02:54 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
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 ;)
|
|

September 25th, 2004, 09:14 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you.... you are the best!!!
|
|

September 25th, 2004, 09:21 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|
|

September 25th, 2004, 11:03 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Do you really want it to close after one minute (60000/1000/60)?
--
Joe
|
|

September 27th, 2004, 02:40 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

September 27th, 2004, 10:34 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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();
}
}
|
|

September 27th, 2004, 12:07 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Elisabeth,
You need to declare your newwin var globally.
HTH,
Chris
|
|

September 27th, 2004, 12:13 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|
|

September 27th, 2004, 12:14 PM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry, it worked!!! ... COuld you explain why??
|
|
 |