Solved

2 popups at load

Posted on 2003-10-21
6
1,897 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

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

Question has a verified solution.

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

Read about why website design really matters in today's demanding market.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will learn how to count occurrences of each item in an array.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

778 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