Creating a window

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

    Creating a window

    I am using the following javacript function (in the HEAD section of the
    HTML file) to open a window in response to user action on the page:

    <SCRIPT LANGUAGE="JavaS cript">
    var PictureWindow;
    var s;
    function displayImage(Im ageName, titleText )
    {
    PictureWindow = window.open()
    s = "<HTML>\n";
    s += " <HEAD>\n";
    s += " <TITLE> </TITLE>\n";
    s += " </HEAD>\n";
    s += " <BODY>\n";
    s += " <CENTER>\n";
    s += " <IMG SRC=\""+ImageNa me+"\" ALT=\"\" BORDER=0>\n";
    s += " <BR><BR>\n";
    s += " <h4>\n";
    s += titleText;
    s += " </h4>\n";
    s += " <BR>\n";
    s += " <A HREF='javascrip t:close()'>Clos e</A>"
    s += " </BODY>\n";
    s += "</HTML>\n";
    PictureWindow.d ocument.write(s );
    }
    </SCRIPT>

    The function works with no trouble in IE. In Netscape, it works, sort of.
    It will create and open the window but will not complete the open process
    (hour glass keeps on).

    Why does this work ok in IE but not Netscape?

    Thanks

  • Dave Griffiths

    #2
    Re: Creating a window

    On Tue, 26 Aug 2003 03:31:16 +0000, Jerrold Kronenfeld wrote:
    [color=blue]
    > I am using the following javacript function (in the HEAD section of the
    > HTML file) to open a window in response to user action on the page:
    >
    > <SCRIPT LANGUAGE="JavaS cript">
    > var PictureWindow;
    > var s;
    > function displayImage(Im ageName, titleText )
    > {
    > PictureWindow = window.open()
    > s = "<HTML>\n";
    > s += " <HEAD>\n";
    > s += " <TITLE> </TITLE>\n";
    > s += " </HEAD>\n";
    > s += " <BODY>\n";
    > s += " <CENTER>\n";
    > s += " <IMG SRC=\""+ImageNa me+"\" ALT=\"\" BORDER=0>\n";
    > s += " <BR><BR>\n";
    > s += " <h4>\n";
    > s += titleText;
    > s += " </h4>\n";
    > s += " <BR>\n";
    > s += " <A HREF='javascrip t:close()'>Clos e</A>"
    > s += " </BODY>\n";
    > s += "</HTML>\n";
    > PictureWindow.d ocument.write(s );
    > }
    > </SCRIPT>
    >
    > The function works with no trouble in IE. In Netscape, it works, sort of.
    > It will create and open the window but will not complete the open process
    > (hour glass keeps on).
    >
    > Why does this work ok in IE but not Netscape?
    >
    > Thanks[/color]
    Hi.

    You need to close the document that you are writing for the hour glass to
    disappear, I'm no expert here just in the very early stages of learning js
    and passed that part of the book just a few weeks ago. Try

    PictureWindow.d ocument.close() this will close the output stream.

    Have fun
    DaveG

    Comment

    Working...