
Problems Closing a New Window using window.close()
<html>
<head>
<script language="
VBScript">
dim myWin
Sub idOpenWin_onclick()
set myWin = window.open(_
"http://www.yahoo.com","","width=200,height=200,left=0,top=0")
End Sub
Sub idCloseWin_onclick()
on error resume next 'in case already closed
myWin.close
on error goto 0
End Sub
</script>
</head>
<body>
<input type="button" id="idOpenWin" value="Open Window">
<input type="button" id="idCloseWin" value="Close Window">
</body>
</html>
--
Michael Harris
Microsoft.MVP.Scripting
Quote:
> Hi,
> I've been having problems closing a new window I opened using window.open()
> method. I'm trying to close it using window.close() method, but no matter
> what I do every time I click on the button that calls the Sub routine to
> close the window, I get a Runtime Error (Object Required). Can you tell me
> the correct way of using window.close() method.
> Thank you.