forked from jackfrued/Python-100-Days
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomework02.html
43 lines (43 loc) · 873 Bytes
/
homework02.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#adv {
width: 200px;
height: 200px;
background-color: blue;
color: yellow;
position: fixed;
right: 50px;
top: 50px;
}
#adv button {
float: right;
}
</style>
</head>
<body>
<div id="adv">
<button>关闭</button>
</div>
<script src="js/mylib.js"></script>
<script>
+function() {
var urls = ['https://www.baidu.com', 'https://www.360.cn/'];
var btn = document.querySelector('#adv button');
var numberOfHits = 0;
bind(btn, 'click', function() {
if (numberOfHits < 2) {
window.open(urls[numberOfHits]);
// $('adv').style.backgroundColor = 'rgba(120, 50, 80, 0.5)';
} else {
$('adv').style.visibility = 'hidden';
}
numberOfHits += 1;
});
}();
</script>
</body>
</html>