0
Write JavaScript to open a new window when a link on a page is clicked. The new window opened, is closed by placing a button on the window & writing JavaScript code on the Onclick event of the button
responsive web design • 1.6k  views
0
1

enter image description here

1

This code displays the close window button in the new window

0

JavaScript New Window Program

<!DOCTYPE html>
<html>
<head>
<title>New Window</title>
<script>
var newWindow;
function openWindow() {
newWindow = window.open("", "newWindow", "width=500,height=600");
newWindow.document.write("<center><h1>Welcome...</h1>");
newWindow.document.write("<h3>This is The New Window</h3></center>");
}
</script>
</head>
<body>
<center>
<a href="javascript:void(0);" onClick="openWindow()">Click here to open the New Window</a><br><br>
<button onclick="newWindow.close()">Close New Window</button>
</center>
</body>
</html>
0
Please log in to add an answer.

Continue reading

Find answer to specific questions by searching them here. It's the best way to discover useful content.

Find more