[Javascript] Alert user when leaving site - Simplified
Judah Frangipane
judah-fc at t8design.com
Mon Sep 12 10:10:05 CDT 2005
Thanks everyone!
Triche Osborne wrote:
> The non-automated version would look like this:
>
> JS (linked or in page HEAD):
>
> function sayGoodbye(domainName)
> {
> if(window.location.hostname != domainName)
> {
> alert("B'Bye!");
> }
> }
>
> Link structure:
>
> <a href="http://www.whatever.com"
> onclick="sayGoodbye(this.hostname);">Link Text</a>
>
> If you like, you can add the onclick event only to outgoing links.
> However, if you choose to automate the attachment of the onclick event
> through an onload function, the function is set up to perform only for
> outgoing links, so it won't matter that the onclick gets attached to
> every link.
>
> Triche
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
More information about the Javascript
mailing list