Click to See Complete Forum and Search --> : window.open an XML --> no event


winmax999
11-04-2003, 10:01 PM
I have the following code which allow you to
(1) open a window if you press 'Click to open'
(2) close it if you press 'Closewin'

I found that step (1) and (2) will work fine if I try to window.open an ordinary html file. But if I'm opening an xml file (with stylesheet inside), step (1) works but step (2) fails to respond the close event. Could anyone please help?

Thanks!

<html>
<head>
<title>Testing Page</title>
<script language="Javascript1.2">
var zoomedWin = null;

function showWin(url)
{
zoomedWin = window.open("testing.html", "zoomedWin");
}
</script>
</head>

<body scroll="yes">
<a href="" onclick="zoomedWin.close();return false">
Closewin</a>
<p>
<A href="#" onclick="showWin(1);return false">Click to Open</A>
</body>
</html>

Khalid Ali
11-04-2003, 10:38 PM
if it doesn't work,then that makes total sense.window.open and window.close are javascript functions that work within the HTMLdocument.XML is not html hence JavaScript can not initiate in it.

winmax999
11-05-2003, 04:13 AM
Originally posted by Khalid Ali
if it doesn't work,then that makes total sense.window.open and window.close are javascript functions that work within the HTMLdocument.XML is not html hence JavaScript can not initiate in it.

What I feel puzzled about is:

To open an HTML file in another window
1.) zoomedWin = window.open('XXX.html') can work
2.) zoomedWin.close() will close the child window, even if the open and close are in different functions and invoked by different event handler

To open an XML file in another window
3.) zoomedWin = window.open('XXX.xml') can also work
4.) zoomedWin.close() will sometimes work, but only if the zoomedWin.close and window.open are run one after each other in response to an event.

As I the open() and close() methods deal with windows, I thought it would not depend on the content of the called window; even if it is a plain text file, I should be able to close a window which I opened using window.open(), right?

I'm using IE6.... just wondering if it's a bug?