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 19th, 2005, 12:55 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to load 6 diff html pages with 1 mouse click

Hello
I think this is a combination of Javascript and html question.

When user clicks a link I want 6 different html pages to popup in separate windows with a 3 sec delay each. Is it possible for first html page to be in the front while the other 5 popup behind it???

How do you do this?



 
Old January 19th, 2005, 04:40 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Try something along these lines:

Code:
var pop1,pop2,pop3,pop4,pop5,pop6;
setTimeout("pop1 = window.open('page1.html','pop1')",3000);
setTimeout("pop2 = window.open('page2.html','pop2');pop1.focus();",6000);
setTimeout("pop3 = window.open('page3.html','pop3');pop1.focus();",9000);
setTimeout("pop4 = window.open('page4.html','pop4');pop1.focus();",12000);
setTimeout("pop5 = window.open('page5.html','pop5');pop1.focus();",15000);
setTimeout("pop6 = window.open('page6.html','pop6');pop1.focus();",18000);
Kind of messy, but it should do the job.

-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old January 20th, 2005, 05:43 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Hope this code never surfaces on any site I visit :)

--

Joe (Microsoft MVP - XML)
 
Old January 20th, 2005, 09:27 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

joefawcett

Relax. The 6 popup windows is for a photography portfolio web site not advertisements.

 
Old January 22nd, 2005, 12:54 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Snib
How do you write you suggestion as a function when click on a href link??

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


I am new to Javascript. Thanks

 
Old January 22nd, 2005, 12:46 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

<html>
<head>
<script language="javascript">
function openWin()
{
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);
}
</script>
</head>
<body>
<a href="javascript:openWin()">Show PopUp Windows</a>
</body>
</html>

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 22nd, 2005, 12:50 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

You could also write a recursive function and create popup windows.


function openWin(pgName, numOfTimes)
{
   if (numOfTimes == 1)
   {
      return
   }
   else
   {
     /*
      Write your logic here and set pgName to new page name
     */
      openWin(pgName, numOfTimes - 1)
   }
}


Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 22nd, 2005, 04:19 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Why do you need a recursive function for this?

Can't this be done with a simple for loop??


Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 22nd, 2005, 10:04 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Sure could be done. Hmm there are different ways to solve a problem let him choose the way which he likes :)

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 23rd, 2005, 01:13 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vadivel
Thank you for your response.
I am popping up 6 different windows with one onclick event.
I am not popping the same one.

Also, I can't figure out how to popup 6 windows with 3 second delay and the each one appearing behind the one before it.

Also, if one set of 6 popup windows are open then I need to disable the onclick event.

I am trying to write a function for this but I can't figure it out. Thank you. Someone please help.





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.