Confirmation of top.window.close

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ScooterMX

    #1

    Confirmation of top.window.close

    I have a <a href="javascrip t:top.window.cl ose()"><img src="exit.gif"> </a>
    tag on my page that closes itself when you click on it.

    What I NEED is for it to put up a confirmation message that simply asks
    "This will end your session and close the window", then offers a cancel or
    ok button. Clicking on ok closes both the page it was on, and the
    confirmation window.

    Can someone suggest a simple way to do this?

    thanks in advance

    Scooter


  • McKirahan

    #2
    Re: Confirmation of top.window.clos e

    "ScooterMX" <scooter@nowher e.org> wrote in message
    news:RBGAd.3755 $5R.441@newssvr 21.news.prodigy .com...[color=blue]
    > I have a <a href="javascrip t:top.window.cl ose()"><img src="exit.gif"> </a>
    > tag on my page that closes itself when you click on it.
    >
    > What I NEED is for it to put up a confirmation message that simply asks
    > "This will end your session and close the window", then offers a cancel or
    > ok button. Clicking on ok closes both the page it was on, and the
    > confirmation window.
    >
    > Can someone suggest a simple way to do this?
    >
    > thanks in advance
    >
    > Scooter
    >[/color]


    Will this work for you? Watch for word-wrap.

    <img src="exit.gif" onclick="if(con firm('This will end your session and
    close the window')) window.close()" >


    Comment

    • ScooterMX

      #3
      Re: Confirmation of top.window.clos e

      Brilliant, thanks. Removing the href made the pointer stop changing (from
      the arrow to the finger) on the mouseover. Is there a way to make it still
      act like an href?


      "McKirahan" <News@McKirahan .com> wrote in message
      news:KeHAd.2544 56$5K2.34461@at tbi_s03...[color=blue]
      > "ScooterMX" <scooter@nowher e.org> wrote in message
      > news:RBGAd.3755 $5R.441@newssvr 21.news.prodigy .com...[color=green]
      > > I have a <a href="javascrip t:top.window.cl ose()"><img[/color][/color]
      src="exit.gif"> </a>[color=blue][color=green]
      > > tag on my page that closes itself when you click on it.
      > >
      > > What I NEED is for it to put up a confirmation message that simply asks
      > > "This will end your session and close the window", then offers a cancel[/color][/color]
      or[color=blue][color=green]
      > > ok button. Clicking on ok closes both the page it was on, and the
      > > confirmation window.
      > >
      > > Can someone suggest a simple way to do this?
      > >
      > > thanks in advance
      > >
      > > Scooter
      > >[/color]
      >
      >
      > Will this work for you? Watch for word-wrap.
      >
      > <img src="exit.gif" onclick="if(con firm('This will end your session and
      > close the window')) window.close()" >
      >
      >[/color]


      Comment

      • Randy Webb

        #4
        Re: Confirmation of top.window.clos e

        ScooterMX wrote:[color=blue]
        > Brilliant, thanks. Removing the href made the pointer stop changing (from
        > the arrow to the finger) on the mouseover. Is there a way to make it still
        > act like an href?[/color]

        Yes. Make it a link and then it acts like a link. Use the onclick of the
        link and return false from it.

        Please don't top-post, read the FAQ with regards to such.

        --
        Randy
        comp.lang.javas cript FAQ - http://jibbering.com/faq
        Answer:It destroys the order of the conversation
        Question: Why?
        Answer: Top-Posting.
        Question: Whats the most annoying thing on Usenet?

        Comment

        • McKirahan

          #5
          Re: Confirmation of top.window.clos e

          "ScooterMX" <scooter@nowher e.org> wrote in message
          news:_GHAd.3872 $5R.1525@newssv r21.news.prodig y.com...[color=blue]
          > Brilliant, thanks. Removing the href made the pointer stop changing (from
          > the arrow to the finger) on the mouseover. Is there a way to make it[/color]
          still[color=blue]
          > act like an href?
          >
          >
          > "McKirahan" <News@McKirahan .com> wrote in message
          > news:KeHAd.2544 56$5K2.34461@at tbi_s03...[color=green]
          > > "ScooterMX" <scooter@nowher e.org> wrote in message
          > > news:RBGAd.3755 $5R.441@newssvr 21.news.prodigy .com...[color=darkred]
          > > > I have a <a href="javascrip t:top.window.cl ose()"><img[/color][/color]
          > src="exit.gif"> </a>[color=green][color=darkred]
          > > > tag on my page that closes itself when you click on it.
          > > >
          > > > What I NEED is for it to put up a confirmation message that simply[/color][/color][/color]
          asks[color=blue][color=green][color=darkred]
          > > > "This will end your session and close the window", then offers a[/color][/color][/color]
          cancel[color=blue]
          > or[color=green][color=darkred]
          > > > ok button. Clicking on ok closes both the page it was on, and the
          > > > confirmation window.
          > > >
          > > > Can someone suggest a simple way to do this?
          > > >
          > > > thanks in advance
          > > >
          > > > Scooter
          > > >[/color]
          > >
          > >
          > > Will this work for you? Watch for word-wrap.
          > >
          > > <img src="exit.gif" onclick="if(con firm('This will end your session and
          > > close the window')) window.close()" >[/color][/color]

          <img src="exit.gif" onclick="if(con firm('This will end your session and
          close the window')) window.close()" style="cursor=h and">

          Though if it's not IE maybe it's "cursor=pointer ".


          Comment

          • Joakim Braun

            #6
            Re: Confirmation of top.window.clos e

            "McKirahan" <News@McKirahan .com> skrev i meddelandet
            news:3FNAd.2830 31$V41.250254@a ttbi_s52...
            <snip>[color=blue]
            > <img src="exit.gif" onclick="if(con firm('This will end your session and
            > close the window')) window.close()" style="cursor=h and">
            >
            > Though if it's not IE maybe it's "cursor=pointer ".[/color]

            style="cursor:p ointer"

            Joakim Braun


            Comment

            • ScooterMX

              #7
              Re: Confirmation of top.window.clos e

              > <snip>[color=blue][color=green]
              > > <img src="exit.gif" onclick="if(con firm('This will end your session and
              > > close the window')) window.close()" style="cursor=h and">
              > >[/color][/color]

              Is there a way to constrain the size of the confirm methods 'window'? The
              text I want to use is rather long, and I want it to wrap rather than
              stretching the message window across the entire screen.


              Comment

              • McKirahan

                #8
                Re: Confirmation of top.window.clos e

                "ScooterMX" <scooter@nowher e.org> wrote in message
                news:B2XAd.4711 $5R.3521@newssv r21.news.prodig y.com...[color=blue][color=green]
                > > <snip>[color=darkred]
                > > > <img src="exit.gif" onclick="if(con firm('This will end your session[/color][/color][/color]
                and[color=blue][color=green][color=darkred]
                > > > close the window')) window.close()" style="cursor=h and">
                > > >[/color][/color]
                >
                > Is there a way to constrain the size of the confirm methods 'window'? The
                > text I want to use is rather long, and I want it to wrap rather than
                > stretching the message window across the entire screen.[/color]

                Use "\n" for a line break:

                <img src="exit.gif" onclick="if(con firm('This \nwill \nend \nyour \nession
                \nand \nclose \nthe \nwindow')) window.close()" style="cursor=h and">


                Comment

                • ScooterMX

                  #9
                  Re: Confirmation of top.window.clos e

                  > > Is there a way to constrain the size of the confirm methods 'window'?
                  The[color=blue][color=green]
                  > > text I want to use is rather long, and I want it to wrap rather than
                  > > stretching the message window across the entire screen.[/color]
                  >
                  > Use "\n" for a line break:
                  >
                  > <img src="exit.gif" onclick="if(con firm('This \nwill \nend \nyour \nession
                  > \nand \nclose \nthe \nwindow')) window.close()" style="cursor=h and">[/color]

                  perfect, thanks.


                  Comment

                  • DU

                    #10
                    Re: Confirmation of top.window.clos e

                    ScooterMX wrote:[color=blue]
                    > Brilliant, thanks. Removing the href made the pointer stop changing (from
                    > the arrow to the finger) on the mouseover. Is there a way to make it still
                    > act like an href?
                    >[/color]

                    First, avoid top-posting. Top-posting destroys chronological order of
                    posts in threads and makes reading more difficult.

                    Second, use a button, not a link. A link should always act like a link,
                    fetching a referenced resource on the web. A link should always work
                    even with javascript support disabled.
                    If you want to add an image into that button, then you still can.

                    Third, you would be a lot better with using the onbeforeunload event
                    attached to the window object: onbeforeunload is supported by MSIE 5+,
                    Firefox, NS 7.2 and Mozilla releases.

                    DU
                    [color=blue]
                    >
                    > "McKirahan" <News@McKirahan .com> wrote in message
                    > news:KeHAd.2544 56$5K2.34461@at tbi_s03...
                    >[color=green]
                    >>"ScooterMX" <scooter@nowher e.org> wrote in message
                    >>news:RBGAd.37 55$5R.441@newss vr21.news.prodi gy.com...
                    >>[color=darkred]
                    >>>I have a <a href="javascrip t:top.window.cl ose()"><img[/color][/color]
                    >
                    > src="exit.gif"> </a>
                    >[color=green][color=darkred]
                    >>>tag on my page that closes itself when you click on it.
                    >>>
                    >>>What I NEED is for it to put up a confirmation message that simply asks
                    >>>"This will end your session and close the window", then offers a cancel[/color][/color]
                    >
                    > or
                    >[color=green][color=darkred]
                    >>>ok button. Clicking on ok closes both the page it was on, and the
                    >>>confirmati on window.
                    >>>
                    >>>Can someone suggest a simple way to do this?
                    >>>
                    >>>thanks in advance
                    >>>
                    >>>Scooter
                    >>>[/color]
                    >>
                    >>
                    >>Will this work for you? Watch for word-wrap.
                    >>
                    >><img src="exit.gif" onclick="if(con firm('This will end your session and
                    >>close the window')) window.close()" >
                    >>
                    >>[/color]
                    >
                    >[/color]

                    Comment

                    Working...