OK, the ajaxtabs.js script only supports session only persistence. So it will need to be edited. Open it up with a text only editor like NotePad. At the beginning add the highlighted:
Code:
//** Ajax Tabs Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 21st, 07 to version 2.0. Contains numerous improvements
//** Updated Feb 18th, 08 to version 2.1: Adds a public "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically. Only .js file changed from v2.0.
//** Updated April 8th, 08 to version 2.2:
// -Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0)
// -Modified Ajax routine so testing the script out locally in IE7 now works
var ddajaxtabssettings={}
ddajaxtabssettings.bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
ddajaxtabssettings.loadstatustext="<img src='ajaxtabs/loading.gif' /> Requesting content..."
ddajaxtabssettings.persitdays=1 //Set number of days for persistence, use 0 for session only
Next find this function:
Code:
ddajaxtabs.setCookie=function(name, value){
document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}
Change it to:
Code:
ddajaxtabs.setCookie=function(n, v, d){
d = d || ddajaxtabssettings.persitdays || null;
if(d){var dt = new Date();
dt.setDate(dt.getDate() + d);
d = '; expires=' + dt.toGMTString();}
document.cookie = n + '=' + escape(v) + (d || '') + '; path=/';
}
Save and use this modified version. If desired, you may change the ddajaxtabssettings.persitdays value at the beginning of the file. Whatever it is set to will be the number of days the cookie will persist for.
Also be sure to enable persistence in your on page ddajaxtabs declaration, ex:
Code:
var countries=new ddajaxtabs("countrytabs", "countrydivcontainer")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()
However, if the browser (yours or anyone else's) is set to not accept cookies or to destroy cookies on exit, this will not work. Generally though most folks accept cookies and allow them to persist from session to session if set that way by this script.
Bookmarks