Problems Closing a New Window using window.close() 
Author Message
 Problems Closing a New Window using window.close()

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.



Tue, 04 May 2004 02:57:18 GMT  
 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.



Tue, 04 May 2004 12:40:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. closing the Yes/No window when closing a Shelled Window

2. Closing Parent Window when the child window closes

3. Automatically closing down Access using code after a Modal window has been closed

4. Closing a child window when parent closes

5. Close all child windows when parent is closed

6. Close IE 5 without prompt for close window confirmation

7. window.close closes webbrowser but not the form itself

8. window.close closes Webbrowser but not the form itself

9. validate a textbox when windows is closed by pressing close button [X]

10. window.close closes Webbrowser but not the form itself

11. VB closing app vs. Windows closing app

12. window.close closes Webbrowser but not the form itself

 

 
Powered by phpBB® Forum Software