Question: 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
0
responsive web design • 1.2k views
ADD COMMENTlink
modified 3 days ago by gravatar for Sanket Shingote Sanket Shingote ♦♦ 280 written 15 months ago by gravatar for Binita Mayekar Binita Mayekar70
1

enter image description here

ADD COMMENTlink
written 12 months ago by gravatar for rrrohra200 rrrohra20010

This code displays the close window button in the new window

ADD REPLYlink
written 12 months ago by gravatar for rrrohra200 rrrohra20010
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>
ADD COMMENTlink
written 15 months ago by gravatar for Binita Mayekar Binita Mayekar70
Please log in to add an answer.