<DOCTYPE html>
<html>
<head>
<title>window open and close</title>
</head>
<body>
<button onclick="openWindow()">Open Window</button>
<button onclick="closeWindow()">Close Window</button>
<script>
var my;
function openWindow()
{
my=window.open("https://tesla.com","_blank","width=500px,height=200px,left=500px,top=200px");
}
function closeWindow()
{
my.close();
}
</script>
</body>
</html>
OUTPUT
Comments
Post a Comment