var urlarr = JSON.parse(sessionStorage.getItem("threemenulist")); console.log(urlarr) var _html = ''; for(var i=0;i
'+urlarr[i].name+'
' }else{ _html += '
  • '+urlarr[i].name+'
  • ' } } $('#button-btn').html(_html); function Router(){ this.routes = {}; this.curUrl = ''; this.route = function(path, callback){ this.routes[path] = callback || function(){}; }; this.refresh = function(){ this.curUrl = location.hash.slice(1) || '/'+urlarr[0].url; console.log(this.curUrl) this.routes[this.curUrl](); }; this.init = function(){ window.addEventListener('load', this.refresh.bind(this), false); window.addEventListener('hashchange', this.refresh.bind(this), false); } } var R = new Router(); R.init(); var res = $('#main-con'); R.route('/apprefund', function() { $("#pageCssLink").attr("href",'../../assets/pages/scripts/refundfile/apprefund/apprefund.css'); res.load('../../assets/pages/scripts/refundfile/apprefund/apprefund.html'); $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive'); $('#button-apprefund').addClass('ITD-topbar-clickactive'); }); R.route('/temprefund', function() { $("#pageCssLink").attr("href",'../../assets/pages/scripts/refundfile/lttk/temprefund.css'); res.load('../../assets/pages/scripts/refundfile/lttk/temprefund.html'); $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive'); $('#button-temprefund').addClass('ITD-topbar-clickactive'); }); R.route('/ltrefund', function() { $("#pageCssLink").attr("href",'../../assets/pages/scripts/refundfile/ltred/ltrefund.css'); res.load('../../assets/pages/scripts/refundfile/ltred/ltrefund.html'); $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive'); $('#button-ltrefund').addClass('ITD-topbar-clickactive'); });