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

January 19th, 2005, 12:55 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

January 19th, 2005, 04:40 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
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?
|
|

January 20th, 2005, 05:43 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Hope this code never surfaces on any site I visit :)
--
Joe ( Microsoft MVP - XML)
|
|

January 20th, 2005, 09:27 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
joefawcett
Relax. The 6 popup windows is for a photography portfolio web site not advertisements.
|
|

January 22nd, 2005, 12:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 22nd, 2005, 12:46 PM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<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
|
|

January 22nd, 2005, 12:50 PM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 22nd, 2005, 04:19 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|

January 22nd, 2005, 10:04 PM
|
|
Friend of Wrox
|
|
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

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