Creating a window

J

Jerrold Kronenfeld

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="JavaScript">
var PictureWindow;
var s;
function displayImage(ImageName, 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=\""+ImageName+"\" ALT=\"\" BORDER=0>\n";
s += " <BR><BR>\n";
s += " <h4>\n";
s += titleText;
s += " </h4>\n";
s += " <BR>\n";
s += " <A HREF='javascript:close()'>Close</A>"
s += " </BODY>\n";
s += "</HTML>\n";
PictureWindow.document.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
 
D

Dave Griffiths

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="JavaScript">
var PictureWindow;
var s;
function displayImage(ImageName, 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=\""+ImageName+"\" ALT=\"\" BORDER=0>\n";
s += " <BR><BR>\n";
s += " <h4>\n";
s += titleText;
s += " </h4>\n";
s += " <BR>\n";
s += " <A HREF='javascript:close()'>Close</A>"
s += " </BODY>\n";
s += "</HTML>\n";
PictureWindow.document.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
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.document.close() this will close the output stream.

Have fun
DaveG
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,082
Messages
2,570,588
Members
47,209
Latest member
Ingeborg61

Latest Threads

Top