Solved

2 popups at load

Posted on 2003-10-21
6
1,898 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

790 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