Answers for "javascript open a window and close it"

10

javascript open new window

<a onclick="window.open(document.URL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');">
Open New Window
</a>
Posted by: Guest on February-13-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 "javascript open a window and close it"

Code answers related to "Javascript"

Browse Popular Code Answers by Language