Click to See Complete Forum and Search --> : Open a new window on exit
bhatijay
12-17-2002, 07:27 PM
Hi All,
Can anyone here tell me how to open a new window and display a different URL when a visitor leave the original webpage?
I am trying to open a opt-in form when a visitor to my page diside to exit.
Thank you for in advance
BJ
96turnerri
09-17-2003, 03:37 PM
have found one before on this site cant find it now but it is there
http://javascript.internet.com/
David Harrison
09-17-2003, 03:41 PM
This should work:
<body onunload="window.open('http://www.w3.org/')">
96turnerri
09-17-2003, 03:43 PM
oi! dont do all the work for em lol :p
David Harrison
09-17-2003, 03:47 PM
There's two ways of learning:
1) Pointing someone in the right direction, (like you did), so that they spend quite some time scratching around until they find what they want.
2) Give them the answer straight away, (like I did), so that they don't have to spend a lot of time looking for it. This way also keeps them coming back for more help, and one little bit at a time they add to their knowledge of JavaScript.
At least that's the way I see it.
96turnerri
09-17-2003, 05:49 PM
well it depends on what type of mood im in to what i tell em, today=bad day, but if they search around like i told him to do (sort of) he may find other scripts that he liks
David Harrison
09-18-2003, 01:38 PM
With me, it doesn't matter what mood I'm in, even when I'm in a bad mood I'll still try and help to the best of my ability. It all depends on whether I can be arsed to help. Today I'm in a bad mood and I can't be arsed, (oh dear).
I was in a school badmiton match and lost 3/3 games, and I'm supposed to be the best one there. I'm absolutely shattered. Eveyrone else at our school lost their games as well though so that makes me feel a bit better.
96turnerri
09-18-2003, 04:15 PM
thats like me on the day i posted that note saying see this site find it on there, i play hl counterstrike and i am very good at it, usually killing bout 15 people only dying 2 or 3 times, that day i couldnt kill no one only got 1 kill and 8 deaths average per game, got my skill back now tho :D
David Harrison
09-18-2003, 04:49 PM
I am so good at UT 2003, but I've only got a 56 Kb modem. You won't believe how bad it is to play online with that slow a connection. My ping time, (if I'm lucky), is 250. I fire my weapon and it fires about half a second later. How crap is that???
96turnerri
09-18-2003, 08:00 PM
0.5sec thats bad i got 512k and my ping is about 50 on all games, havnt played ut 2k3 my computer wont run it lol, theres you with a good comp and a slow connection, me with a slow comp and a good connection lol, ever played cs?
David Harrison
09-19-2003, 06:54 AM
I haven't got that good a PC, I can't run the game with all of the graphics options on full, half of them have to be on just less than full.
It's going on 2 years out of date now:
Athlon MP 1800+
Ge-Force 3
512Mb RAM
only 40Gb HDD
No, by the way I haven't played Counter-Strike although I know some people at school that do.
How I would love to blow £4000 at Alienware (http://www.alienware.co.uk/)!!!
96turnerri
09-21-2003, 05:43 AM
nice how i would to you ever thought about playing cs, im gonna try and pick up a copy of ut 2k3 ive just made a clan for cs called .iR. Insane Reactions
David Harrison
09-21-2003, 05:52 AM
Well, that all depends. It has to be a good game in single player mode, and it also depends on whether Game still sell it.
But if I see it then I might buy it.
96turnerri
09-21-2003, 06:26 AM
yeah game still sell it you can get half life generations 4 games in one for £13, thats hlaf life, counterstrike, opposing force and blueshift
David Harrison
09-21-2003, 09:46 AM
I'll have a look for it next weekend when I go.
By the way I hope that bhatijay's question has been answered.
96turnerri
09-21-2003, 11:26 AM
oh yeah lol forgot about that, yeah good luck with that bhatijay
spykemitchell
09-21-2003, 01:30 PM
These guys are such nerds... :D Kidding...
If you want a customised window e.g with no status bars etc..
PUT IN HEAD TAG
<SCRIPT LANGUAGE="JavaScript">
function flyUP(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=500,left = 0,top = 0');");
}
</script>
THEN USE THIS AS BODY TAG
<body onunload="javascript:flyUP('http://www.somewhere.com')"
P.s. I didn't steal this one Pyro!! :p
David Harrison
09-21-2003, 01:55 PM
If you want to open a new winow that looks jut like a normal window then you could do this:
<body onunload="document.a_form.submit();">
<form target="_blank" name="a_form" action="page.html" method="post"></form>
Then when the window is closed it will submit the form and open a new window.