-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWindow-Open-close.html
More file actions
34 lines (31 loc) · 1.07 KB
/
Window-Open-close.html
File metadata and controls
34 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Window Open And Close</title>
<style>
h2{
text-align: center;
color: rgb(17, 23, 107);
}
</style>
</head>
<body>
<h2>Syntax : window.open(URL,name, specs)</h2>
<button onclick="openWindow()">Open Window</button>
<button onclick="closeWindow()">Open Window</button>
<script>
// function openWindow(){
// window.open();//creates a new window in the browser.
function openWindow(){
//window.open("http://www.facebook.com","_parent");//_blank,_parent these are the other methods
window.open("http://www.facebook.com","","width = 500px,height = 200px"); //it will open a new window with specific size.
}
function closeWindow{
window.close();//this function will help to close the window.
}
</script>
</body>
</html>