Solved

2 popups at load

Posted on 2003-10-21
6
1,899 Views
Last Modified: 2011-04-14
I am using the following to open a popup when loading the page.
I need to open two separate popups, and need the code for it.
Please note I am not a coder, so I need details, I do understand the pixel size of the window, so don't worry about that.
The second popup is named popup2.html

<script language="Javascript"><!--
function open_on_entrance(url,name)
{
new_window=window.open('http://www.ilbarettoverona.com/popup.html','yahoocom','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,Width=377,height=580,screenX=20,screenY=20,top=40,left=40')
}
// -->
</script>
<link href="style.css" rel="styleSheet" type="text/css">
</head>
<body bgcolor="black" onload="open_on_entrance()">

For few extra can someone tell me why is it that if I don't put the 'yahoocom' on the above code the popup won't load?

Thank you
0
Comment
Question by:keneso
  • 3
  • 2
6 Comments
 
LVL 5

Accepted Solution

by:
boro_bob earned 90 total points
ID: 9591373
Try this. Just copy the first new_window line and paste it below, and make the changes. The yahoocom is just a name for the window. The window needs to have a name, but it shouldn't matter what it is. The window names do need to be different though.

<script language="Javascript"><!--
function open_on_entrance(url,name)
{
new_window=window.open('http://www.ilbarettoverona.com/popup.html','yahoocom','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,Width=377,height=580,screenX=20,screenY=20,top=40,left=40')

new_window2=window.open('http://www.ilbarettoverona.com/popup2.html','popup2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,Width=377,height=580,screenX=20,screenY=20,top=50,left=50')
}
// -->
</script>
<link href="style.css" rel="styleSheet" type="text/css">
</head>
0
 
LVL 17

Expert Comment

by:paulop1975
ID: 9591400
I guess you cando ir like this:

<script language="Javascript"><!--
function open_on_entrance(url,name)
{
new_window=window.open(url,name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,Width=377,height=580,screenX=20,screenY=20,top=40,left=40')
}
// -->
</script>
<link href="style.css" rel="styleSheet" type="text/css">
</head>
<body bgcolor="black"
  onload="open_on_entrance('http://www.ilbarettoverona.com/popup.html','yahoocom'); open_on_entrance('popup2.html','Name of the Popup2 window')">

Hope this works and good luck!
:)

Fui (portuguese for "gone")
c(ô.Ô)o

pAul0|PIm3NTA
0
 
LVL 17

Expert Comment

by:paulop1975
ID: 9591415
The way I made the code, you can open any URL (popup window) you which using the sme funtion. That's why functions are so usefull.
;)

Good luck!

Fui (portuguese for "gone")
c(ô.Ô)o

pAul0|PIm3NTA
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 5

Expert Comment

by:boro_bob
ID: 9591459
If you do it like that Paulop, you are forced to have the windows the exact same size, and appear on top of each other. The way I suggested means that you can set different properties for each window. :)
0
 
LVL 5

Expert Comment

by:boro_bob
ID: 9591460
If you do it like that Paulop, you are forced to have the windows the exact same size, and appear on top of each other. The way I suggested means that you can set different properties for each window. :)
0
 
LVL 7

Author Comment

by:keneso
ID: 9591562
Than you both

I picked boro_bob's cause it was exactly what I wanted.

I had tried copying and pasting, with the change from popup.html to popup2.html,
but it didn't work because I didn't know about the 'name' (yahoocom), the same for both windows.
Now I renamed that too, so it's more clear.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question