javascript window problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: javascript window problem

Hybrid View

  1. #1
    john Guest

    javascript window problem


    Hi

    I'm using javascript window.open to open an .asp page to get some user input.
    This window is opened above my current webpage, but is there any way to make
    this new window modal so that the user can't access the page underneath it
    ???

    If there isn't a way to do this, is there any way to know when the new window
    is loosing focus (like a onLostFocus event or something similar). I thought
    I could use an approach like this to close the window if the focus is lost

    Help appeciated
    ** Please response to the group ***

    /John

  2. #2
    Harold Hunsaker Guest

    Re: javascript window problem


    "john" <john70@hotmail.com> wrote:
    >
    >Hi
    >
    >I'm using javascript window.open to open an .asp page to get some user input.
    >This window is opened above my current webpage, but is there any way to

    make
    >this new window modal so that the user can't access the page underneath

    it
    >???
    >
    >If there isn't a way to do this, is there any way to know when the new window
    >is loosing focus (like a onLostFocus event or something similar). I thought
    >I could use an approach like this to close the window if the focus is lost
    >
    >Help appeciated
    >** Please response to the group ***
    >
    >/John


    John:

    There is no onLostFocus event handler for the window object, but you can

    use the onFocus event handler of the parent window to close that window.

  3. #3
    James Guest

    Re: javascript window problem


    John,

    I tried it by putting a call to window.close(); in the onblur event of the
    body tag on the "modal" window and it worked in IE 5.5. The window closed
    when I clicked away from that browser window.

    I have seen modal windows, but cannot remember how they were done. I know
    that it is not as simple as "newWindow = window.open("blah.htm", modal);"
    The one time that I saw it done, the guy had some trick he used...sorry,
    I can't remember. (it may have even been done with client-side VBScript).

    Good Luck



    "john" <john70@hotmail.com> wrote:
    >
    >Hi
    >
    >I'm using javascript window.open to open an .asp page to get some user input.
    >This window is opened above my current webpage, but is there any way to

    make
    >this new window modal so that the user can't access the page underneath

    it
    >???
    >
    >If there isn't a way to do this, is there any way to know when the new window
    >is loosing focus (like a onLostFocus event or something similar). I thought
    >I could use an approach like this to close the window if the focus is lost
    >
    >Help appeciated
    >** Please response to the group ***
    >
    >/John





  4. #4
    Russell Jones Guest

    Re: javascript window problem

    If you're using IE, look at the showModalDialog (IE4 and higher) method. The
    command creates a modal dialog (defined in a separate file)and displays it
    above the opening HTML document. For Netscape browsers, Webreference.com
    states:

    "You can achieve [a] similar effect in Navigator by specifying the onBlur
    event handler:
    <BODY onBlur="window.focus()">
    If you use the above event handler in the <BODY> tag, the window holding the
    document remains focused until the user closes it. There are several
    differences between this Navigator-only technique and Internet Explorer's
    showModalDialog() method. First of all, the focused window isn't associated
    with a specific window (or document). That is, the user cannot bring up any
    other browser window, even if it isn't the window that opened the dialog
    window. In addition, the user can still bring up a different window for a
    moment, which is enough to close the opener window while the "modal" dialog
    is open."

    "john" <john70@hotmail.com> wrote in message
    news:3b5b18aa$1@news.devx.com...
    >
    > Hi
    >
    > I'm using javascript window.open to open an .asp page to get some user

    input.
    > This window is opened above my current webpage, but is there any way to

    make
    > this new window modal so that the user can't access the page underneath it
    > ???
    >
    > If there isn't a way to do this, is there any way to know when the new

    window
    > is loosing focus (like a onLostFocus event or something similar). I

    thought
    > I could use an approach like this to close the window if the focus is lost
    >
    > Help appeciated
    > ** Please response to the group ***
    >
    > /John




  5. #5
    benG Guest

    Re: javascript window problem


    hi,

    i've been researching this same problem this week. Since u asked for a modal
    window, the following link is the most comprehensive that I have found -
    cross browser/platform modal window:

    http://developer.netscape.com:80/vie...man_modal.html

    regards
    benG

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center