PDA

View Full Version : I have five popup links on one page.


webcom8
04-20-2003, 04:41 AM
The variable “popurl” is “comm1.htm” through “comm5.htm”. Only the “comm5.htm”, being the last popup on the page, will open for all of the, five, popup links. How can I get each popup to open it’s own respective page?
Example follows.
Thanks for any answers.

<script>

function openpopup(){
var popurl="comm1.htm"
winpops=window.open(popurl,"","width=480,height=450,status,")
}

</script>

<script>

function openpopup(){
var popurl="comm2.htm"
winpops=window.open(popurl,"","width=480,height=450,status,")
}

</script>

<script>

function openpopup(){
var popurl="comm3.htm"
winpops=window.open(popurl,"","width=480,height=450,status,")
}

</script>

<script>

function openpopup(){
var popurl="comm4.htm"
winpops=window.open(popurl,"","width=480,height=450,status,")
}

</script>

<script>

function openpopup(){
var popurl="comm5.htm"
winpops=window.open(popurl,"","width=480,height=450,status,")
}

</script>

Vladdy
04-20-2003, 02:49 PM
:rolleyes: like opening one popup at a time aint annoying enough :rolleyes: :D :D :D


window name should be different for each

justagirl
05-03-2003, 05:50 PM
OK, I understand where that needs to go after the

window.open(popurl,"name")

but what is "name" relative to? Therein lies the confusion.

BTW, 5 popup windows are only annoying if they are automatic popups. I think calling a popup window as opposed to a standard link is much nicer because your window is open only to as large as it needs to be. Mine, for instance, are relative to a catalogue listing, so when the customer hits the link a little window pops up showing them what the item looks like.

Personally, I would never subject my visitors to even 1 automatic popup. All my popups are on demand!

liorean
05-03-2003, 06:58 PM
window.open(sHref, sName, sProps)

sName is the internal window name - the same name that you can use for targeting a window or frame by the target attribute on links. If you want to find it out, I think you can get the it from window.name in named windows, but I'm not sure.

zenweezil
05-04-2003, 09:56 AM
What I do is include one script in the header as follows:


<SCRIPT LANGUAGE="JavaScript">
function popup(sURL) {
newwindow=open(sURL,"popupname","scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=370,height=400");
}
</script>


And then whenever I need a popup window I just add an onclick command in the link code:

<a href="http://whatever" target="nfl" onclick="window.open'','nfl','width=480,height=480');">Whatever text or image</a>

The key is the two places i used the word nfl - if all the links say the same thing they will open in the same window. If they are all different they will open in different windows. you can use any text as the popupname.

AS you can see I actually listed different window sizes in the main script, but was able to override that default saize in the link itself.