Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e54fc48

Browse files
window object in js
1 parent cc6d1e0 commit e54fc48

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

‎Basic Introduction/index.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,34 @@
99
<body>
1010

1111
<button id="btn1">Google</button>
12+
<button id="btn2">Yahoo</button>
13+
<button id="btn3">close</button>
1214

1315
<script>
1416

1517
let btn1 = document.getElementById('btn1');
18+
let btn2 = document.getElementById('btn2');
19+
let btn3 = document.getElementById('btn3');
20+
21+
1622
let url = "https://www.google.com";
1723
let name = "google";
1824
let features = "height=500 , width = 500";
25+
let win;
26+
27+
btn1.addEventListener('click' , function(){
28+
win = window.open(url , name , features);
29+
})
30+
31+
btn2.addEventListener('click' , function(){
32+
window.open('https://www.yahoo.com' , 'google');
33+
})
34+
35+
btn3.addEventListener('click', function(){
36+
win.close();
37+
})
1938

20-
window.open(url,name,features);
39+
2140

2241
</script>
2342

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /