$(function(){ window.onload = function () { var isType=sessionStorage.getItem("isType"); var data={module:1}; if(isType==1){ var fenlei=$.ajaxGet("get","/open/app/home/getCategoryList",data); dataUse(fenlei.data); } //sessionStorage.removeItem("isType"); } function random(lower, upper) { return Math.floor(Math.random() * (upper - lower)) + lower; } function dataUse(datas){ var datalength=datas.length; var ulHtml=""; var mydiv=""; for(var a=0;a${topLevel}` mydiv+=`
`; $("#myDiv").html(mydiv); $("#myTab").html(ulHtml); $("#myTab>li:nth-child(1)").addClass("active"); $("#myDiv>div:nth-child(1)").addClass("active"); } for(var a=0;a

${child[b].name}

`; } $("#"+a).html(divHtml); } } $("#myDiv").on("click",".clickdiv",function(){ //传过去作为二级ID var dataid=$(this).attr("date"); //传过去当一级ID var dataids=$(".ul_dz>li.active").attr("date"); sessionStorage.setItem("dataid",dataid); sessionStorage.setItem("dataids",dataids); }) })