当前位置:编程学习 > JSP >>

求高手帮忙看下这段jsp代码写的页面树有什么问题

在点击第六个二级分类时总是点不开,求帮忙,很急 function Show(id,i_id){ var on_img="images/open.png"; var off_img="images/close.png"; var obj=document.getElementById('c_'+id); if(obj.style.display=="none"){ obj.style.display=""; i_id.src=on_img; var curShow = readCookie('curShow'); if(curShow!='') { var arr_curShow = curShow.split(','); var found = false; for(i=0;i<arr_curShow.length-1;i++) { if(arr_curShow[i].toString()==id) {found=true;} } if(!found){writeCookie('curShow',curShow+','+id,12)} } else { writeCookie('curShow',id,12) } }else{ obj.style.display="none"; i_id.src=off_img; var curShow = readCookie('curShow'); if(curShow!='') { var arr_curShow = curShow.split(','); for(i=0;i<arr_curShow.length;i++) { if(arr_curShow[i].toString()==id) {arr_curShow=arr_curShow.del(i--);} } curShow = arr_curShow.join(','); //alert(curShow); writeCookie('curShow',curShow,12) } } } function readCookie(name) { var cookieValue = ""; var search = name + "="; if(document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; cookieValue = unescape(document.cookie.substring(offset, end)) } } return cookieValue; } function writeCookie(name, value, hours) { var expire = ""; if(hours != null) { expire = new Date((new Date()).getTime() + hours * 3600000); expire = "; expires=" + expire.toGMTString(); } document.cookie = name + "=" + escape(value) + expire; } Array.prototype.del=function(n) { if(n<0) return this; else return this.slice(0,n).concat(this.slice(n+1,this.length)); } window.onload = function a() { var curShow = readCookie('curShow'); var totalShow = 7; //自己修改一共有多少个二级分类 if(curShow!=''&&curShow!=null) { for(i=1;i<=totalShow;i++) { document.getElementById('c_'+i).display="none"; } var arr_curShow; arr_curShow = curShow.split(','); for(i=0;i<=arr_curShow.length-1;i++) { if(arr_curShow[i]!=''){document.getElementById('c_'+arr_curShow[i]).style.display="";} } } }
追问:
我改了,但好像还是没用啊
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,