Answers for "close a window opened with javascript"

0

html close window button

<button type="button" onclick="javascript:window.close()"> Name </button>
Posted by: Guest on November-16-2020
6

javascript close window

<!DOCTYPE html>
<html>
<body>

<button onclick="openWin()">Open "myWindow"</button>
<button onclick="closeWin()">Close "myWindow"</button>

<script>
var myWindow;

function openWin() {
  myWindow = window.open("", "myWindow", "width=200,height=100");
  myWindow.document.write("<p>This is 'myWindow'</p>");
}

function closeWin() {
  myWindow.close();
}
</script>

</body>
</html>
Posted by: Guest on April-06-2020

Code answers related to "close a window opened with javascript"

Browse Popular Code Answers by Language