close a window

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

    #1

    close a window

    I open page 1 and page 2 from main page. I want to close page 2 from
    page 1 after I finish processing some work in page 1. Does anyone
    know how to do that?

    Thanks,

    Jenny
  • DU

    #2
    Re: close a window

    Jenny wrote:[color=blue]
    > I open page 1 and page 2 from main page. I want to close page 2 from
    > page 1 after I finish processing some work in page 1. Does anyone
    > know how to do that?
    >
    > Thanks,
    >
    > Jenny[/color]

    Jenny, you need to give more details, explanations. Usually, in web
    programming newsgroups such as this one, the *best* is to provide an url
    so that regulars of this newsgroup and javascript experts can see the
    page: these people can examine, understand your pages' logic as fast as
    you can read the newspapers' headlines.

    Here, I don't know if the opener opens page1 and then page1 opens page2
    and how these pages are opened: automatically? via target attribute or
    via window.open()? And if you opened these or 1 of the 2 with
    window.open(), then how you coded all this.. etc.etc..

    An url is best to figure this out or sufficient chunks of relevant code.

    DU
    --
    Javascript and Browser bugs:


    Comment

    • ManoDestra

      #3
      Re: close a window

      I'm assuming that page 1 is opening the page 2 and page 3. If this is the
      case, then you could probably just get page 3 to call a function in page 1
      to do the close other wise you will probably get a security error message as
      you can't close a page from javascript on a page that didn't open the page
      in the first place. Need user authorisation to proceed with it.

      on page 3...

      window.opener.m yClose();

      function myClose() {
      page1.close();
      }

      Not easy to describe this, but I hope you get the idea.

      Peter.

      "DU" <drunclear@hotR EMOVEmail.com> wrote in message
      news:bfhqht$jhb $1@news.eusc.in ter.net...[color=blue]
      > Jenny wrote:[color=green]
      > > I open page 1 and page 2 from main page. I want to close page 2 from
      > > page 1 after I finish processing some work in page 1. Does anyone
      > > know how to do that?
      > >
      > > Thanks,
      > >
      > > Jenny[/color]
      >
      > Jenny, you need to give more details, explanations. Usually, in web
      > programming newsgroups such as this one, the *best* is to provide an url
      > so that regulars of this newsgroup and javascript experts can see the
      > page: these people can examine, understand your pages' logic as fast as
      > you can read the newspapers' headlines.
      >
      > Here, I don't know if the opener opens page1 and then page1 opens page2
      > and how these pages are opened: automatically? via target attribute or
      > via window.open()? And if you opened these or 1 of the 2 with
      > window.open(), then how you coded all this.. etc.etc..
      >
      > An url is best to figure this out or sufficient chunks of relevant code.
      >
      > DU
      > --
      > Javascript and Browser bugs:
      > http://www10.brinkster.com/doctorunclear/
      >[/color]


      Comment

      • Mosley Jones III

        #4
        Re: close a window


        "Jenny" <jennychen20030 306@yahoo.com> wrote in message
        news:b4e6db09.0 307210822.632ee dc1@posting.goo gle.com...[color=blue]
        > I open page 1 and page 2 from main page. I want to close page 2 from
        > page 1 after I finish processing some work in page 1. Does anyone
        > know how to do that?
        >
        > Thanks,
        >
        > Jenny[/color]





        Comment

        • point

          #5
          Re: close a window

          Nice...but maybe you could help me....

          I have also a window opener and a function like this...

          function alert_message()
          {
          if(!popup && !popup.open && popup.closed) alert("Don't forget to
          refresh!");
          }

          and I call that function from child window with:

          body onunload="docum ent.opener.aler t_message()">

          but I don't get alert message when I close a child window...

          any suggestions ???

          respect...

          "Mosley Jones III" <me@info.gov.ma rs> wrote in message
          news:3f1c90ae$2 @funnel.arach.n et.au...[color=blue]
          >
          > "Jenny" <jennychen20030 306@yahoo.com> wrote in message
          > news:b4e6db09.0 307210822.632ee dc1@posting.goo gle.com...[color=green]
          > > I open page 1 and page 2 from main page. I want to close page 2 from
          > > page 1 after I finish processing some work in page 1. Does anyone
          > > know how to do that?
          > >
          > > Thanks,
          > >
          > > Jenny[/color]
          >
          >
          > http://mosley.arach.net.au/test/windows.htm
          >
          >[/color]


          Comment

          • Richard Cornford

            #6
            Re: close a window

            "point" <point@caanprod uction.com> wrote in message
            news:bfj28102bh 0@enews2.newsgu y.com...
            <snip>[color=blue]
            > and I call that function from child window with:
            >
            > body onunload="docum ent.opener.aler t_message()">
            >
            > but I don't get alert message when I close a child window...[/color]
            <snip>

            opener is not a property of the document object, it is a property of the
            global (window) object. So:-

            onunload="opene r.alert_message ();"
            -or-
            onunload="windo w.opener.alert_ message();"

            - should work better.

            Ricahrd.


            Comment

            • Mosley Jones III

              #7
              Re: close a window


              "point" <point@caanprod uction.com> wrote in message
              news:bfj28102bh 0@enews2.newsgu y.com...[color=blue]
              > Nice...but maybe you could help me....
              >
              > I have also a window opener and a function like this...
              >
              > function alert_message()
              > {
              > if(!popup && !popup.open && popup.closed) alert("Don't forget to
              > refresh!");
              > }
              >
              > and I call that function from child window with:
              >
              > body onunload="docum ent.opener.aler t_message()">
              >[/color]

              window.operner not document


              [color=blue]
              > but I don't get alert message when I close a child window...
              >
              > any suggestions ???
              >
              > respect...
              >
              > "Mosley Jones III" <me@info.gov.ma rs> wrote in message
              > news:3f1c90ae$2 @funnel.arach.n et.au...[color=green]
              > >
              > > "Jenny" <jennychen20030 306@yahoo.com> wrote in message
              > > news:b4e6db09.0 307210822.632ee dc1@posting.goo gle.com...[color=darkred]
              > > > I open page 1 and page 2 from main page. I want to close page 2 from
              > > > page 1 after I finish processing some work in page 1. Does anyone
              > > > know how to do that?
              > > >
              > > > Thanks,
              > > >
              > > > Jenny[/color]
              > >
              > >
              > > http://mosley.arach.net.au/test/windows.htm
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • point

                #8
                Re: close a window

                Hy guys...

                thanx for the help...

                I tried this:
                onunload="opene r.alert_message ();"

                and got the error: popup in undefined???

                I opened a window using this:

                function popUp(URL)
                {
                openwindow=wind ow.open(URL, 'popup',
                'toolbar=0,scro llbars=1,locati on=0,statusbar= 0,menubar=0,res izable=0,width= 3
                00,height=400,t op=0,left=0');
                }

                respect...


                "Richard Cornford" <richard@litote s.demon.co.uk> wrote in message
                news:bfj8jm$q4g $1@titan.btinte rnet.com...[color=blue]
                > "point" <point@caanprod uction.com> wrote in message
                > news:bfj28102bh 0@enews2.newsgu y.com...
                > <snip>[color=green]
                > > and I call that function from child window with:
                > >
                > > body onunload="docum ent.opener.aler t_message()">
                > >
                > > but I don't get alert message when I close a child window...[/color]
                > <snip>
                >
                > opener is not a property of the document object, it is a property of the
                > global (window) object. So:-
                >
                > onunload="opene r.alert_message ();"
                > -or-
                > onunload="windo w.opener.alert_ message();"
                >
                > - should work better.
                >
                > Ricahrd.
                >
                >[/color]


                Comment

                Working...