[RESOLVED] Jasascript - Are you sure you want to leave this page-VBForums
Results 1 to 5 of 5

Thread: [RESOLVED] Jasascript - Are you sure you want to leave this page

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    Campbell, OH USA
    Posts
    282

    Resolved [RESOLVED] Jasascript - Are you sure you want to leave this page

    I see it all over the place...you are on a web site...you accidentally click the X instead of the minimize/maximize button...and the Javascript prompts you "Are you sure you want to leave this page?"

    How is this done?
    Which X do you like better???
    Code:
    x     x       \      /
     x   x         \    /
      x x           \  /
       x             ><
      x x           /  \
     x   x         /    \
    x     x       /      \

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    Campbell, OH USA
    Posts
    282

    Re: Jasascript - Are you sure you want to leave this page

    Any one know this one?
    Which X do you like better???
    Code:
    x     x       \      /
     x   x         \    /
      x x           \  /
       x             ><
      x x           /  \
     x   x         /    \
    x     x       /      \

  3. #3
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    3,949

    Re: Jasascript - Are you sure you want to leave this page

    A little javascript should do it.
    Code:
    <html>
    <head>
    <script language="javascript" type="text/javascript">
    window.onbeforeunload = askConfirm;
    function askConfirm(){
            return "You have unsaved changes.";
            }
    </script>
    </head>
    <body>
    </body>
    </html>

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,120

    Re: Jasascript - Are you sure you want to leave this page

    @ rrrctraptor31

    Instead of putting the code in each page put it in an external javascipt file.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    Campbell, OH USA
    Posts
    282

    Re: Jasascript - Are you sure you want to leave this page

    thank you both...i plan on using this in a time clock system that I have build...it used DHTML windows...so there is only one real page...everything else is in <#includes>
    Which X do you like better???
    Code:
    x     x       \      /
     x   x         \    /
      x x           \  /
       x             ><
      x x           /  \
     x   x         /    \
    x     x       /      \

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.