标签:
写法1:
<script> var database = function () { function add(){ console.info("add"); } function queryAll(){ console.info("queryAll"); } /** 带参数 */ function delById(id){ console.info("delById:" +id); } return { add:add, queryAll:queryAll, delById:delById } }(); database.add(); database.delById(34); console.info(database); </script>
URL HASH:
<script src="js/jquery-2.1.4.min.js"></script>
<script>
function route() {
var page = window.location.hash;
console.info(page);
}
$(function() {
$(window).bind("hashchange", route);
})
</script>
<a href="#1">1</a>
<a href="#2">2</a>
使用#实现页面不刷新改变数据。
标签:
原文地址:http://www.cnblogs.com/yg_zhang/p/4770643.html