Re: Java Script Message

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Thu, 18 May 2000 06:56:37 CDT
 To:  RHessel281(at)aol.com
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
the technique that most porn sites use is legnthly and a pain in the arse, 
but it works. the problem is, you want to know if they are leaving your 
site, or merely following a link. try this:

<!-- in the HEAD -->
<script>
<!--
var stay = false;
function goodbye(){
  if(!staying)
    alert("Good bye!");
}
function stay(){
  return (staying = true);
}
//-->
</script>

<!-- in the BODY tag -->
onUnLoad="goodbye();"

then from each link on your page that links to another page on your site, 
you add an onClick event handler to the link:

<!-- in the (A)nchor tag -->
onClick="return stay();"

on links that leave your site, you just use regular links. if they enter a 
new URL or click a link to leave, then your message is displayed. - 
Cyanide_7

>
>From: <RHessel281(at)aol.com>
> > I'm looking for the code that will give you a message when you click
>through
> > to leave one site to enter another one.  Maybe a message like "You are 
>now
> > leaving ......... site"
>
><a href="somewhere.html" onClick="alert('you are leaving this
>site');">somewhere else</a>
>
>Kae
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA