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. java script problem

java script problem

Scheduled Pinned Locked Moved ASP.NET
javatoolshelpquestion
10 Posts 5 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.
  • S Offline
    S Offline
    Sonia Gupta
    wrote on last edited by
    #1

    i have a java script confirm message box , which i am invoking at the page closing.The window is closing at both the buttons ok and cancel.y it is happening?how i can I keep the window open , ok clicking the cancel button.

    Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

    V S 2 Replies Last reply
    0
    • S Sonia Gupta

      i have a java script confirm message box , which i am invoking at the page closing.The window is closing at both the buttons ok and cancel.y it is happening?how i can I keep the window open , ok clicking the cancel button.

      Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      Did you consider using onBeforeUnload instead of confirm? http://msdn2.microsoft.com/en-us/library/ms536907.aspx[^]

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      S 1 Reply Last reply
      0
      • S Sonia Gupta

        i have a java script confirm message box , which i am invoking at the page closing.The window is closing at both the buttons ok and cancel.y it is happening?how i can I keep the window open , ok clicking the cancel button.

        Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

        S Offline
        S Offline
        Sandeep Kumar
        wrote on last edited by
        #3

        Hi here is the code.......... function close() { event.returnValue = "Any string value here forces a dialog box to appear before closing the window."; }

        Regards, Sandeep Kumar.V

        G 1 Reply Last reply
        0
        • V Vasudevan Deepak Kumar

          Did you consider using onBeforeUnload instead of confirm? http://msdn2.microsoft.com/en-us/library/ms536907.aspx[^]

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #4

          in body tag , i am calling onBeforeUnload() = "abc();" function abc() { if( confirm('ok')) return true; still it does not keep the window open , while i am clicking the cancel button. }

          Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

          S P G 3 Replies Last reply
          0
          • S Sonia Gupta

            in body tag , i am calling onBeforeUnload() = "abc();" function abc() { if( confirm('ok')) return true; still it does not keep the window open , while i am clicking the cancel button. }

            Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

            S Offline
            S Offline
            Sandeep Kumar
            wrote on last edited by
            #5

            Hi anthor way of doing the things..... function close() { return window.confirm("Click ok to close"); }

            Regards, Sandeep Kumar.V

            S G 2 Replies Last reply
            0
            • S Sandeep Kumar

              Hi anthor way of doing the things..... function close() { return window.confirm("Click ok to close"); }

              Regards, Sandeep Kumar.V

              S Offline
              S Offline
              Sonia Gupta
              wrote on last edited by
              #6

              even now, the moment , i click the cancel button, the window is vanishing. please help.

              Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

              1 Reply Last reply
              0
              • S Sonia Gupta

                in body tag , i am calling onBeforeUnload() = "abc();" function abc() { if( confirm('ok')) return true; still it does not keep the window open , while i am clicking the cancel button. }

                Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

                P Offline
                P Offline
                Paddy Boyd
                wrote on last edited by
                #7

                I think you're missing the else part of that if, where it will return false if not ok...

                1 Reply Last reply
                0
                • S Sandeep Kumar

                  Hi anthor way of doing the things..... function close() { return window.confirm("Click ok to close"); }

                  Regards, Sandeep Kumar.V

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  The window object already has a method named close, so that is not a good method name.

                  --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

                  1 Reply Last reply
                  0
                  • S Sonia Gupta

                    in body tag , i am calling onBeforeUnload() = "abc();" function abc() { if( confirm('ok')) return true; still it does not keep the window open , while i am clicking the cancel button. }

                    Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    Sonia Gupta wrote:

                    in body tag , i am calling onBeforeUnload() = "abc();"

                    Attributes in an html tag doesn't have parentheses. Also, you have to return the value from the function call to the event: onbeforeunload="return abc();"

                    --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

                    1 Reply Last reply
                    0
                    • S Sandeep Kumar

                      Hi here is the code.......... function close() { event.returnValue = "Any string value here forces a dialog box to appear before closing the window."; }

                      Regards, Sandeep Kumar.V

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #10

                      Sandeep Kumar Vuppala wrote:

                      function close()

                      (Not a good name, but I already mentioned that elsewhere in the thread.)

                      Sandeep Kumar Vuppala wrote:

                      event.returnValue

                      The window.event object only exists in Internet Explorer. Just return the value from the function:

                      function closingMessage() {
                      return "Any string value here forces a dialog box to appear before closing the window.";
                      }

                      Sandeep Kumar Vuppala wrote:

                      You have to pass the value returned from the function on to the event: onbeforeunload="return closingMessage();"

                      --- "Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things." -- Douglas Adams

                      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