<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>前端路由实现</title>   
</head>
<body>
<ul>
    <li><a href="#/">默认页</a></li>
    <li><a href="#/home">主页</a></li>
    <li><a href="#/about">详情页</a></li>
</ul>
<div id="content"></div>
<script type="text/javascript" src="router2.js"></script>
<script type="text/javascript">
window.onload = function() {
    var router = new Router();
    router.add('home', function() {
        console.log('这是主页');
    }); 
    router.add('about', function() {
        console.log('这是详情页');
    });
    router.setIndex('home');
    router.start();
};
</script>
</body>
</html>