Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Is it possible to run a function when the red x is clicked?

Is it possible to run a function when the red x is clicked?

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JohnQuar1
    wrote on last edited by
    #1

    Hello, I am wondering if there is some functionality with the upper right exit button when it is pushed. I need to do a check to make sure that a button was pushed (save button) before they close the browser. Is this possible? Thanks! John Michael

    A 1 Reply Last reply
    0
    • J JohnQuar1

      Hello, I am wondering if there is some functionality with the upper right exit button when it is pushed. I need to do a check to make sure that a button was pushed (save button) before they close the browser. Is this possible? Thanks! John Michael

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Do this here :

      function doUnload()
      {
      if (window.event.clientX < 0 && window.event.clientY < 0)
      {
      alert("Window is closing...");
      }
      }
      ...

      Just do your code inside the alert.

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      J 1 Reply Last reply
      0
      • A Abhishek Sur

        Do this here :

        function doUnload()
        {
        if (window.event.clientX < 0 && window.event.clientY < 0)
        {
        alert("Window is closing...");
        }
        }
        ...

        Just do your code inside the alert.

        Abhishek Sur


        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

        **Don't forget to click "Good Answer" if you like to.

        J Offline
        J Offline
        JohnQuar1
        wrote on last edited by
        #3

        This is a real stupid question, but when I open the script, is it technically javascript? So would I write and then write your code? By the way, I'm my website is in C# Thanks! You've been a big help!</x-turndown>

        A 1 Reply Last reply
        0
        • J JohnQuar1

          This is a real stupid question, but when I open the script, is it technically javascript? So would I write and then write your code? By the way, I'm my website is in C# Thanks! You've been a big help!</x-turndown>

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          Yes of course... inside <script > tag :-D :-D

          Abhishek Sur


          My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

          **Don't forget to click "Good Answer" if you like to.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups