Popup code needed, anyone?

Discussion in 'JavaScript' started by Voimis, Oct 8, 2007.

  1. #1
    Hi there!

    I need a popup code which appears when exiting the site. It shouldn´t appear when uses link to different page, just when user is exiting the whole site to another site or shutting down the browser.

    How to do that?

    Also if somebody knows how to do a popup which changes the place where it appears...would be very great!

    Thanks a lot guys!

    Voimis
     
    Voimis, Oct 8, 2007 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    Use
    
    In <head>
    <script>
    write exit code
    </script>
    </head>
    <body onUnload="exit()" >
    
    Code (markup):
     
    it career, Oct 8, 2007 IP
  3. Voimis

    Voimis Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ...and what then? Where I should put text which should appear on popup?

    I´m a newbie with JavaScript :D
     
    Voimis, Oct 8, 2007 IP
  4. kfir

    kfir Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    And would this help him? he wanted the popup to appear when they leave his website and this will make the popup each and every time they'll switch a page...
     
    kfir, Oct 15, 2007 IP
  5. temp2

    temp2 Well-Known Member

    Messages:
    1,231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    2
    #5
    temp2, Oct 16, 2007 IP
  6. Voimis

    Voimis Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks to you temp2!


    I have also another question:

    Is there any way to change the place where popup appears?
    I mean is it possible that multiple popups appears in different places one after one, not all in the same place in center of the window.

    Thanks!
     
    Voimis, Oct 18, 2007 IP