Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    N.E. Ohio
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    on unload function

    I have a (quasi) legitimate reason to use the "on unload function," and now can't find where I was reading about it...

    does anyone know where to locate script for it?
    How come this stuff seems so simple when you guys do it? It takes me three days to figure how to ask my questions half-way intelligently!
    Judy

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Colorado, USA
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Judy, could give us an idea of what you want to happen with the onunload event handler. It makes a difference what script is used and could also need to include special syntax for cross browser compatibility.

    Example: If you just want to use the built-in alert box function for Netscape and Explorer to say "Thank you for visiting Regardless Shorthairs" then this anywhere in the body will do it.
    <BODY onUnload="alert('Thank you for visiting Regardless Shorthairs')">
    Even this doesn't work for other browsers.


    Edit: for sp.
    Last edited by newmate; 06-23-2002 at 02:58 AM.
    Editor; FrontPage 2002 (included in Office XP). Personal Operating System; Windows XP and ME. Browsers; Latest versions, NN, IE and Opera. Server running; RedHat Linux 7.2

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    window.onunload = fuction() {
    alert('Unloading!');
    }

    Quick example of how to use it.

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    N.E. Ohio
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I may have a perverted sense of humor,

    but I found a script:

    http://html_help4u2.tripod.com/dontclik.html

    that I think is really neat. When you click on a button, a page comes up that looks like what you see when you're downloading a program (sort of anyway). It says:

    "Now downloading virus"

    and looks as though something is actually downloading.

    I'd like to use it, but I can picture people madly trying to close the window, and leaving my site.

    So I want to use "on unload" to take them to a page explaining that it was a joke, with a history (-2) to take them back to the page they came from.

    An "on unload" pop-up would be nice, but I don't think I've ever seen one...
    Last edited by Judy; 06-23-2002 at 03:58 AM.
    How come this stuff seems so simple when you guys do it? It takes me three days to figure how to ask my questions half-way intelligently!
    Judy

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts

    Re: I may have a perverted sense of humor,

    Good heavens, no. Certainly not. Who could posibly have thought that?

  • #6
    Banned
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamicdrive Unload popup

    <script>

    /*
    Fair well window launcher script
    By JavaScript Kit (http://javascriptkit.com)
    Over 200+ free scripts here!
    */

    function openpopup(){
    //configure "seeyou.htm and the window dimensions as desired
    window.open("seeyou.htm","","width=300,height=338")
    }

    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
    offset += search.length
    // set index of beginning of value
    end = document.cookie.indexOf(";", offset);
    // set index of end of cookie value
    if (end == -1)
    end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }

    function loadpopup(){
    if (get_cookie('popped')==''){
    openpopup()
    document.cookie="popped=yes"
    }
    }

    </script>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •