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('/geomagneticmanage', function() { $("#pageCssLink").attr("href",'../../assets/pages/scripts/equipmentPeration/css/geomagneticmanage.css'); res.load('../../assets/pages/scripts/equipmentPeration/pages/geomagneticmanage.html'); $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive'); $('#button-geomagneticmanage').addClass('ITD-topbar-clickactive'); }); R.route('/pdamanage', function() { $("#pageCssLink").attr("href",'../../assets/pages/scripts/equipmentPeration/css/pdamanage.css'); res.load('../../assets/pages/scripts/equipmentPeration/pages/pdamanage.html'); $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive'); $('#button-pdamanage').addClass('ITD-topbar-clickactive'); }); R.route('/geomagneticData', function() { $("#pageCssLink").attr("href",'../../assets/pages/scripts/equipmentPeration/css/geomagneticData.css'); res.load('../../assets/pages/scripts/equipmentPeration/pages/geomagneticData.html'); $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive'); $('#button-geomagneticData').addClass('ITD-topbar-clickactive'); });