HTML DOM close() Method
Complete Window Object Reference
Definition and Usage
The close() method is used to close the current window.
Syntax
Example
The following example closes the new window:
<html>
<head>
<script type="text/javascript">
function closeWin()
{
myWindow.close()
}
</script>
</head>
<body>
<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>
<input type="button" value="Close 'myWindow'"
onclick="closeWin()" />
</body>
</html>
|
Try-It-Yourself Demos
Close a window
when clicking on a button
Complete Window Object Reference
|
|
|