Popup window loses focus alert

Discussion in 'Javascript' started by Colin Graham, Apr 19, 2005.

  1. Colin Graham

    Colin Graham Guest

    Hi there,

    i want to create a piece of javascript that checks to see if a popup
    window is open when the user clicks on the main form. If the popup is
    open it will set focus back to the popup and display an alert message.

    im not sure of the event to use on the main form to call the function
    or how to write the function.

    any help greatly appreciated as im a bit pushed for time on this one.

    thanks in advance

    colin
     
    Colin Graham, Apr 19, 2005
    #1
    1. Advertising

  2. Colin Graham

    kaeli Guest

    In article <>, csgraham74
    @hotmail.com enlightened us with...
    > Hi there,
    >
    > i want to create a piece of javascript that checks to see if a popup
    > window is open when the user clicks on the main form.


    Clarify what you mean by "clicking on the main form" if you need help with
    the event trapping. Clicking on the page that contains the form? On an
    element IN the form? On a div that contains the form?
    Generally, you're probably looking at onclick or onfocus, depending on the
    element.

    > If the popup is
    > open it will set focus back to the popup and display an alert message.
    >
    > im not sure of the event to use on the main form to call the function
    > or how to write the function.
    >
    > any help greatly appreciated as im a bit pushed for time on this one.
    >


    Modify mine.

    /* functions that get called when user presses a help button */
    var h_window = null;
    function openHelp(screenName)
    {
    if (!h_window || h_window == null || typeof h_window == "undefined" ||
    h_window.closed || !h_window.document)
    h_window = window.open("","Help","height=200,width=
    200,scrollbars=yes,resizable=yes");
    var doc = h_window.document;
    doc.open();
    doc.writeln("<html><head><title>Help</title>");
    doc.writeln("<link rel='stylesheet' type='text/css'
    href='myStylesheet.css'>");
    doc.writeln("</head><body>");
    doc.writeln(h_array[screenName]);
    doc.writeln("</body></html>");
    doc.close();
    h_window.focus();
    return;
    }

    --
    --
    ~kaeli~
    The more ridiculous a belief system, the higher probability
    of its success.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Apr 19, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernie
    Replies:
    22
    Views:
    9,908
    Skeevy Dan
    Aug 7, 2007
  2. Ganesh
    Replies:
    0
    Views:
    585
    Ganesh
    Jun 29, 2007
  3. Raffi
    Replies:
    4
    Views:
    263
    Dr John Stockton
    Aug 12, 2004
  4. Paresh Shah

    HTML Window Focus alert

    Paresh Shah, Nov 2, 2004, in forum: Javascript
    Replies:
    3
    Views:
    187
    McKirahan
    Nov 3, 2004
  5. Roger
    Replies:
    3
    Views:
    380
Loading...

Share This Page