Code:
var pageVars;
function fillPageVars()
{
var pageVarsTemp=(document.location.hash.length>1) ? document.location.hash.substring(1).split('&') : new Array(0);
if (pageVars)
delete pageVars;
pageVars=new Object();
for (var i=0; i<pageVarsTemp.length; i++)
{
var tempArray=pageVarsTemp[i].split('=');
pageVars[tempArray[0]]=tempArray[1];
}
}
The function above fills the "pageVars" variable from the URL and you can use the "GET" parameters like in PHP. BUT this code uses the anchor, #, not the common ? seperator since if you change the url's ? part it reloads the page, however if you change after the anchor it does not reload.
So you can use a function which looks for pageVars["tab"] variable and then expands the tab according to it. If you want to do this only when the page loads, you can call that function from onLoad, if you want to change the active tab wehenever the url changes, then put your function in an interval.
Bookmarks