Help please

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

    Help please

    The following works well while using NS or IE but not Opera.
    In Opera, a blank window is opened.
    Anyone have a suggestion on what to change to make it work in all
    three?
    Thanks for any and all help received.

    <!--
    function regwin(mylink, windowname, refocus)
    {
    var mywin, href;

    if (typeof(mylink) == 'string')
    href=mylink;
    else
    href=mylink.hre f;

    mywin = window.open('', windowname);


    // if we just opened the window
    if (
    mywin.closed ||
    (! mywin.document. URL) ||
    (mywin.document .URL.indexOf("a bout") == 0)
    )
    mywin.location= href;
    else if (refocus)
    mywin.focus();
    return false;

    }
    //-->
  • kaeli

    #2
    Re: Help please

    In article <ts0tq0llur5p66 tqttkjmvae4sb25 lmc56@4ax.com>, user@name.com
    enlightened us with...[color=blue]
    > The following works well while using NS or IE but not Opera.
    > In Opera, a blank window is opened.
    > Anyone have a suggestion on what to change to make it work in all
    > three?
    > Thanks for any and all help received.
    >
    > <!--
    > function regwin(mylink, windowname, refocus)
    > {
    > var mywin, href;
    >
    > if (typeof(mylink) == 'string')
    > href=mylink;
    > else
    > href=mylink.hre f;
    >
    > mywin = window.open('', windowname);
    >
    >
    > // if we just opened the window
    > if (
    > mywin.closed ||
    > (! mywin.document. URL) ||
    > (mywin.document .URL.indexOf("a bout") == 0)
    > )
    > mywin.location= href;
    > else if (refocus)
    > mywin.focus();
    > return false;
    >
    > }
    > //-->
    >[/color]

    It looks to me like you're trying to re-use the window. It also appears that
    Opera is always testing false for your condition that checks if the window is
    open.
    With that in mind, here's my function for re-using my help window. It works
    in Opera as well as Gecko and IE. It's a bit different than yours, since it
    writes content from an array to a blank window, but maybe the way I test to
    see if the window is already open can work for you.

    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;
    }

    HTH

    --
    --
    ~kaeli~
    Local Area Network in Australia:... the LAN down under.



    Comment

    Working...