-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp111`.html
More file actions
55 lines (43 loc) · 1.16 KB
/
p111`.html
File metadata and controls
55 lines (43 loc) · 1.16 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Window close example</title>
<script>
var yourWindow;
function openWindow() {
yourWindow = window.open("","","width = 500, height = 300")
}
function closeWindow() {
if(yourWindow)
{
yourWindow.close();
}
}
function checkWin() {
if(!yourWindow)
{
document.getElementById("msg").innerHTML="'yourWindow' has never been opened!";
}
else
{
if(yourWindow.closed){
document.getElementById("msg").innerHTML="'yourWindow''s closed!";
}
else
{
document.getElementById("msg").innerHTML="'yourWindow''s not closed!";
}
}
}
</script>
</head>
<body>
<input type="button" value="open 'yourWindow'" onclick="openWindow()" >
<input type="button" value="close 'yourWindow'" onclick="closeWindow()" >
<br><br>
<input type="button" value="Has 'yourWindow' been cloased?" onclick="checkWin()" >
<br><br>
<div id="msg"></div>
</body>
</html>