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 January 23rd, 2005, 01:42 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Snib
I tried you suggestion:
var pop1,pop2,pop3,pop4,pop5,pop6;
setTimeout("pop1 = window.open('page1.html','pop1')",3000);
setTimeout("pop2 = window.open('page2.html','pop2');pop1.focus();",60 00);
setTimeout("pop3 = window.open('page3.html','pop3');pop1.focus();",90 00);
setTimeout("pop4 = window.open('page4.html','pop4');pop1.focus();",12 000);
setTimeout("pop5 = window.open('page5.html','pop5');pop1.focus();",15 000);
setTimeout("pop6 = window.open('page6.html','pop6');pop1.focus();",18 000);

The funny thing is that the last popup window 'page6.html' even with pop1.focus is the one in the front.
I know it doesn't make sense but the last popupwindows is always the one in the front.
What can I do to solve this problem??

 
Old January 23rd, 2005, 05:55 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Maybe because the focus code runs before the popup actually opens. Perhaps:
Code:
var arrPopups;

function openPopupAndBlur(Url)
{
  var oNewWin = window.open(Url);
  arrPopups.push(oNewWin);
  oNewWin.blur;
  setTimeout("arrPopups[0].focus()", 1000);
}

function openAllPopups()
{
  setTimeout("openPopupAndBlur('page1.html')",3000);
  setTimeout("openPopupAndBlur('page2.html')",6000);
  //etc.
}

--

Joe (Microsoft MVP - XML)
 
Old January 23rd, 2005, 06:48 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

And if that doesn't help, simply shuffle the windows around in your code, so the one you need on top opens last.... ;)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 23rd, 2005, 08:43 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for all your suggestions.
I wanted to know if it possible to pop up 6 html pages with one onclick event.
Having each pop up window pop up behind with a 3 sec delay. It is important that the first pop up window stay in the front so that while it is preloading images the second html pop up window opens. Then while second pop up preloads, the 3rd windows pops up behind that. This way by the time the last pop up window opens at least all 4 popup windows have finished preloading images.

-----------------------------------------------------------
var arrPopups;

function openPopupAndBlur(Url)
{
  var oNewWin = window.open(Url);
  arrPopups.push(oNewWin);
  oNewWin.blur;
  setTimeout("arrPopups[0].focus()", 1000);
}

function openAllPopups()
{
  setTimeout("openPopupAndBlur('page1.html')",3000);
  setTimeout("openPopupAndBlur('page2.html')",6000);
  //etc.
}
This code doesn't make the focus on the page1.html. The focus is on the last page not first pop up window
----------------------------------------------------------
this suggestion:
var pop1,pop2,pop3,pop4,pop5,pop6;
setTimeout("pop1 = window.open('page1.html','pop1')",3000);
setTimeout("pop2 = window.open('page2.html','pop2');pop1.focus();",60 00);
setTimeout("pop3 = window.open('page3.html','pop3');pop1.focus();",90 00);
setTimeout("pop4 = window.open('page4.html','pop4');pop1.focus();",12 000);
setTimeout("pop5 = window.open('page5.html','pop5');pop1.focus();",15 000);
setTimeout("pop6 = window.open('page6.html','pop6');pop1.focus();",18 000);

The funny thing is that the last popup window 'page6.html' even with pop1.focus is the one in the front.
I know it doesn't make sense but the last popupwindows is always the one in the front.

--------------------------------------------------

What can I do to keep the first window in the front?????











Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse right-click inoperable Neal Excel VBA 2 March 16th, 2007 05:32 AM
right click mouse event sen22 ASP.NET 2.0 Basics 5 December 16th, 2006 08:46 AM
Capturing Mouse Click Event whiterainbow ASP.NET 1.0 and 1.1 Professional 1 December 8th, 2005 01:44 AM
detect mouse click off form vb certified Beginning VB 6 6 July 7th, 2005 07:55 PM
Mouse Click Event roniestein Access 4 December 11th, 2003 04:53 AM





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