Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-08-2009, 02:56 AM   PM User | #1
uydarp
New to the CF scene

 
Join Date: Jan 2009
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
uydarp is an unknown quantity at this point
I want to creating a popup window for my website project can any body help?

1. the 1st popup should open automatically and open a URL 1
2. then after 30sec the popup should close
3. then 2nd pop up window should appear and open URL2
4. then after 30sec the popup should close and so on

can any body help me with this please. I really need it.

Or it can be like this also,

The 1st popup should open automatically and open a URL1 then, after 30sec it should open URL2 and after 30 sec open URL3 and so on in the same popup. Please help.
uydarp is offline   Reply With Quote
Old 01-08-2009, 05:31 AM   PM User | #2
jcrypt
New Coder

 
Join Date: Jan 2009
Posts: 42
Thanks: 2
Thanked 6 Times in 6 Posts
jcrypt is an unknown quantity at this point
Code:
<html>
<head>
<script>
var win,intvl;

// variable to keep track of current array index
var i = 0;

// create array of urls to display in the popup
var urls = ['http://www.site.com/page1.htm',
                'http://www.site.com/page2.htm',
                'http://www.site.com/page3.htm'];

window.onload = function() {
   showPopup();
   intvl = setInterval(showPopup,30000);
}

function showPopup() {
   if (!win || win.closed) win = window.open('','_blank','width=500,height=300');
   win.location = urls[i];
   (i == urls.length-1) ? i = 0 : ++i;
}
</script>
</head>
<body>
test page
</body>
</html>
jcrypt is offline   Reply With Quote
Users who have thanked jcrypt for this post:
uydarp (01-09-2009)
Old 01-08-2009, 07:20 AM   PM User | #3
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,037
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by uydarp View Post
1. the 1st popup should open automatically and open a URL 1
2. then after 30sec the popup should close
3. then 2nd pop up window should appear and open URL2
4. then after 30sec the popup should close and so on

can any body help me with this please. I really need it.

Or it can be like this also,

The 1st popup should open automatically and open a URL1 then, after 30sec it should open URL2 and after 30 sec open URL3 and so on in the same popup. Please help.
That is why modern browsers block unrequested pop-ups.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
itsallkizza (01-08-2009)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:51 AM.


Advertisement
Log in to turn off these ads.