Mod-Jay Posted February 4, 2011 Share Posted February 4, 2011 var Cookie = { get: function(name) { cookies = document.cookie; name = cookiePrefix+name+"="; cookiePos = cookies.indexOf(name); if(cookiePos != -1) { cookieStart = cookiePos+name.length; cookieEnd = cookies.indexOf(";", cookieStart); if(cookieEnd == -1) { cookieEnd = cookies.length; } return unescape(cookies.substring(cookieStart, cookieEnd)); } }, set: function(name, value, expires) { if(!expires) { expires = "; expires=Wed, 1 Jan 2020 00:00:00 GMT;" } else { expire = new Date(); expire.setTime(expire.getTime()+(expires*1000)); expires = "; expires="+expire.toGMTString(); } if(cookieDomain) { domain = "; domain="+cookieDomain; } else { domain = ""; } if(cookiePath != "") { path = cookiePath; } else { path = ""; } document.cookie = cookiePrefix+name+"="+escape(value)+"; path="+path+domain+expires; }, unset: function(name) { Cookie.set(name, 0, -1); } }; var expandables = { init: function() { expanders = $$('img.expander'); if(expanders.length > 0) { expanders.each(function(expander) { if(!expander.id) { return; } Event.observe(expander, "click", this.expandCollapse.bindAsEventListener(this)); if(NoXiP.browser == "ie") { expander.style.cursor = "hand"; } else { expander.style.cursor = "pointer"; } expander.controls = expander.id.replace("_img", ""); var row = $(expander.controls); if(row) { Event.observe(row, "dblclick", this.expandCollapse.bindAsEventListener(this)); row.controls = expander.id.replace("_img", ""); } }.bind(this)); } }, expandCollapse: function(e) { element = Event.element(e) if(!element || !element.controls) { return false; } var expandedItem = $(element.controls+"_e"); var collapsedItem = $(element.controls+"_c"); if(expandedItem && collapsedItem) { if(expandedItem.style.display == "none") { expandedItem.show(); collapsedItem.hide(); this.saveCollapsed(element.controls); } else { expandedItem.hide(); collapsedItem.show(); this.saveCollapsed(element.controls, 1); } } else if(expandedItem && !collapsedItem) { if(expandedItem.style.display == "none") { expandedItem.show(); element.src = element.src.replace("collapse_collapsed.gif", "collapse.gif"); element.alt = "[-]"; element.title = "[-]"; this.saveCollapsed(element.controls); } else { expandedItem.hide(); element.src = element.src.replace("collapse.gif", "collapse_collapsed.gif"); element.alt = "[+]"; element.title = "[+]"; this.saveCollapsed(element.controls, 1); } } return true; }, saveCollapsed: function(id, add) { var saved = new Array(); var newCollapsed = new Array(); var collapsed = Cookie.get("collapsed"); if(collapsed) { saved = collapsed.split("|"); saved.each(function(item) { if(item != id && item != "") { newCollapsed[newCollapsed.length] = item; } }); } if(add == 1) { newCollapsed[newCollapsed.length] = id; } Cookie.set("collapsed", newCollapsed.join("|")); } }; I cannot figure out whats wrong with it. Please take a look. Quote Link to comment https://forums.phpfreaks.com/topic/226714-collapse-and-expand-not-working/ Share on other sites More sharing options...
Maq Posted February 4, 2011 Share Posted February 4, 2011 What happens? Errors? What do you expect to happen? What makes you think something is wrong with it? We need more information... Quote Link to comment https://forums.phpfreaks.com/topic/226714-collapse-and-expand-not-working/#findComment-1169989 Share on other sites More sharing options...
Mod-Jay Posted February 4, 2011 Author Share Posted February 4, 2011 Its supposed to Expand And collopse my Tables and It dont, I took out some code that does nothing to that and it stopped working. Quote Link to comment https://forums.phpfreaks.com/topic/226714-collapse-and-expand-not-working/#findComment-1169991 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.