Forum Moderators: open
I have this triple exit console script:
<!Begin Triple Exit Code -->
<SCRIPT language="JavaScript">var exit=true; function at()
{ if (exit)
open('page1.htm');
open('page2.htm');
open('page3.htm');
} </SCRIPT>
<!End Triple Exit Code -->
onunload="at()"
I want to have control over the dimensions of the pops. I tried modifing the code with something like this:
<SCRIPT language="JavaScript">
var exit=true; function at() { if
(exit) open('page1.htm', "displayWindow", "toolbar=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=60,height=60");
open('page3.htm', "displayWindow", "toolbar=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=60,height=60");
open('page4.htm', "displayWindow", "toolbar=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=60,height=60");
} </SCRIPT>
But only the first popup excutes and nothing else. I'm not too javascript savvy. Can someone please help me out?
Thank You
Fess
In addition to needing additional brackets as Jim suggests,
i.e.
function fn() {
if (){...}
}
another problem is that you named all your pop-ups the same thing ("displayWindow"), so only one window is opening. A new window will only open if you don't already have a window or frame open with that name. If there is a window open with that name, the new url will open in that window. I'm surprised you say only the first open works. The impression you would get is that only the last one worked. To fix it, call the windows something like "displayWindow1", "displayWindow2", "displayWindow3".
I feel compelled to add that I had a big moral dilema here... Should I assist someone do something that I have very strong feelings against? In the end I thought I'd help, as I guessed that what you are trying to do is probably quite honourable, and that you would never dream of sending visitors off to 3 other sites in pop-ups when they leave yours, as that is very unethical and very irritating to the visitor. And besides, I guessed that you would never dream of doing it as you would have read that while it may temporarily increase your referal statistics, sooner or later the sites the visitor is being sent to realise that these are unwilling visitors and stop paying the referal fees. Please help me retain my sanity and reassure me that my guess is correct by letting me know why you are trying to open 3 pop-ups on exit.
Shawn
Your instructions were successful. The functional code is:
<!Begin Triple Exit Code -->
<SCRIPT language="JavaScript">var exit=true; function at() {
if (exit){
open('page1.htm', "displayWindow1", "toolbar=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=60,height=60");
open('page2.htm', "displayWindow2", "toolbar=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=60,height=60");
open('page3.htm', "displayWindow3", "toolbar=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=60,height=60");}
} </SCRIPT>
<!End Triple Exit Code -->
This script will be archived and put to use for a week our so on a toplists I'm revamping.
Shawn, I'm aware of the teeth grinding annoyance of the 'popup' so I use them now and again for ad purposes, but only in small doses :o)
I think I have made a good investment in joining webmasterworld because I see the high standard of membership here. Thanks again for all your help...
Regards
Fess