#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Posts
    2
    Rep Power
    0

    javascript timed popup on exit


    the following code will work onload but when I use onunload for exit it doesn't.
    <html>
    <head>
    <title></title>

    <script language="javascript">
    <!--
    function go(){
    setTimeout('openit()', 3000);

    }
    // -->
    <!--
    function openit() {
    newWindow = window.open('index.html', 'myWindow','width=628,height=333');
    }
    // -->
    </script>

    </head>
    <body onunload="go()">

    hi
    </body>
    </html>

    does anyone know how to create a timed popup window on exit of main?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    florida
    Posts
    7
    Rep Power
    0
    onUnload event is fired when the window is closed. It should not be burdent with any scripts the are delayed( coz window does not wait for the script to run and finish)

    the code runs fine with <body onUnload="openit()" >

    --that is, with no delay at all

    Another way to pop a window on close of a window is to use a html button to run code to --

    --minimise the window
    --wait for the delay time
    --restore window and load new url

IMN logo majestic logo threadwatch logo seochat tools logo