Popup window loses focus alert

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

    #1

    Popup window loses focus alert

    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
  • kaeli

    #2
    Re: Popup window loses focus alert

    In article <ee261922.05041 90517.2aec760b@ posting.google. com>, csgraham74
    @hotmail.com enlightened us with...[color=blue]
    > 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.[/color]

    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.
    [color=blue]
    > 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.
    >[/color]

    Modify mine.

    /* functions that get called when user presses a help button */
    var h_window = null;
    function openHelp(screen Name)
    {
    if (!h_window || h_window == null || typeof h_window == "undefined" ||
    h_window.closed || !h_window.docum ent)
    h_window = window.open("", "Help","height= 200,width=
    200,scrollbars= yes,resizable=y es");
    var doc = h_window.docume nt;
    doc.open();
    doc.writeln("<h tml><head><titl e>Help</title>");
    doc.writeln("<l ink rel='stylesheet ' type='text/css'
    href='myStylesh eet.css'>");
    doc.writeln("</head><body>");
    doc.writeln(h_a rray[screenName]);
    doc.writeln("</body></html>");
    doc.close();
    h_window.focus( );
    return;
    }

    --
    --
    ~kaeli~
    The more ridiculous a belief system, the higher probability
    of its success.



    Comment

    Working...