-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.html
36 lines (32 loc) · 1.24 KB
/
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
<html>
<head>
<title>Test RouterJs</title>
<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- History.js -->
<script src="https://raw.github.com/balupton/history.js/master/scripts/bundled/html4+html5/jquery.history.js"></script>
<!-- Routerjs -->
<script src="Router.js" type="text/javascript"></script>
</head>
<body>
<div id="log"></div>
<script>
var router = new Router();
router.route('/posts/:id/p:page', function(id,page){
$('div#log').html("Route /posts/:id/p:page triggered with argument "+id+" "+page);
})
router.route('/list/*path', function(path){
$('div#log').html("Route /list/*path triggered with argument "+path);
})
router.route('relative/:id', function(id,page){
$('div#log').html("Route relative/:id triggered with argument "+id);
})
</script>
<h2>Absolute Routes</h2>
<button type="button" onclick='router.navigate("/posts/first_post/p12");'>/posts/first_post/p12</button>
<button type="button" onclick='router.navigate("/list/files/all");'>/list/files/all</button>
<a href="#/posts/first_post/p18" title="">#/posts/first_post/p18</a>
<h2>Relative Routes</h2>
<button type="button" onclick='router.navigate("relative/123");'>relative/123</button>
</body>
</html>