A new pop up window will not obey a close command from original page.

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

    A new pop up window will not obey a close command from original page.

    I am trying to create a new window from which the original page can
    close that new window. For some reason the following code will not
    work. Passing the window.open command to a variable called myWindow
    does not work with the mouse event, but it seems to work fine with a
    javascript: URL command. I would prefer to do it with the mouse event.

    Please assist. I can not find any documentation for this in any of my
    books.


    <!-- Code begins -->

    <html>
    <body>

    <a href="#" onMouseDown="va r myWindow=window .open('text.htm l',
    'bobby', 'width=200, height=200');"> Open</a>.
    <a href="#" onMouseDown="my Window.close(); ">Close</a>.

    </body>
    </html>

    <!-- Code ends -->
  • Lasse Reichstein Nielsen

    #2
    Re: A new pop up window will not obey a close command from originalpage.

    marc0047@yahoo. com (Marc) writes:
    [color=blue]
    > I am trying to create a new window from which the original page can
    > close that new window. For some reason the following code will not
    > work. Passing the window.open command to a variable called myWindow
    > does not work with the mouse event, but it seems to work fine with a[/color]
    [color=blue]
    > <a href="#" onMouseDown="va r myWindow=window .open('text.htm l',[/color]

    The contents of the onmousedown attribute value is used as the body of
    a function. That means that "var myWindow" declares a local variable
    in that function ....

    [color=blue]
    > <a href="#" onMouseDown="my Window.close(); ">Close</a>.[/color]

    .... which is not visible from another function.
    Drop the "var" and it should work.

    Btw,
    [color=blue]
    > 'bobby', 'width=200, height=200');"> Open</a>.[/color]

    spaces in the configuration string confuzes some browsers. Remove the
    space before "height", and it should work in more browsers.

    Add ",resizable=yes ". In the cases where 200x200 isn't enough (and
    with user stylesheets, there can be some that you can't predict),
    you should allow the user to resize the window. If the content fits,
    he probably won't resize anything, so it doesn't hurt to add it.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Marc

      #3
      Re: A new pop up window will not obey a close command from original page.

      Thank you. That definately worked. I also found articles on local and
      global variables, and I have a better understanding of how it works.

      I will also be sure to follow the guidelines for the pop up window.

      Thanks,
      Marc

      Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<he0vjp5j. fsf@hotpop.com> ...[color=blue]
      > marc0047@yahoo. com (Marc) writes:
      >[color=green]
      > > I am trying to create a new window from which the original page can
      > > close that new window. For some reason the following code will not
      > > work. Passing the window.open command to a variable called myWindow
      > > does not work with the mouse event, but it seems to work fine with a[/color]
      >[color=green]
      > > <a href="#" onMouseDown="va r myWindow=window .open('text.htm l',[/color]
      >
      > The contents of the onmousedown attribute value is used as the body of
      > a function. That means that "var myWindow" declares a local variable
      > in that function ....
      >
      >[color=green]
      > > <a href="#" onMouseDown="my Window.close(); ">Close</a>.[/color]
      >
      > ... which is not visible from another function.
      > Drop the "var" and it should work.
      >
      > Btw,
      >[color=green]
      > > 'bobby', 'width=200, height=200');"> Open</a>.[/color]
      >
      > spaces in the configuration string confuzes some browsers. Remove the
      > space before "height", and it should work in more browsers.
      >
      > Add ",resizable=yes ". In the cases where 200x200 isn't enough (and
      > with user stylesheets, there can be some that you can't predict),
      > you should allow the user to resize the window. If the content fits,
      > he probably won't resize anything, so it doesn't hurt to add it.
      >
      > /L[/color]

      Comment

      Working...