-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
38 lines (38 loc) · 908 Bytes
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="router.js"></script>
<title>Router Test Case</title>
</head>
<body>
<ul>
<li><a href="#/">white</a></li>
<li><a href="#/green">green</a></li>
<li><a href="#/yellow">yellow</a></li>
<li><a href="#/red">red</a></li>
<li><a href="#/pink">pink</a></li>
</ul>
<script type="text/javascript">
var body = document.querySelector('body');
function changeBodyColor(color) {
body.style.backgroundColor = color;
}
Router.route('/', function() {
changeBodyColor('white');
});
Router.route('/green', function() {
changeBodyColor('green');
});
Router.route('/yellow', function() {
changeBodyColor('yellow');
});
Router.route('/red', function() {
changeBodyColor('red');
});
Router.route('/pink', function() {
changeBodyColor('pink');
});
</script>
</body>
</html>