Entry
How to introduce a Collapsible TOC list using the saveHistory behavior(IE5+)
How to persist current page status using the saveHistory(IE5+)
How to introduce "saveHistory" behavior (IE5+)
May 12th, 2008 20:45
i can do it, Hiroto Sekine, http://www.all.co.nz/support/withlove/indexd.htm
(IE5+):To introduce a collapsible TOC list, try the following code;
Also you can test how it works at the active sample site. At the page
click a link to jump to another page, then click the "bcack" button to
return the starting page, you will see the page has been persisted the
page status. Also you may download all the related files there.
Sample Coding:
<?xml version='1.1' encoding='windows-1252'?>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD XHTML 1.1 Transitional//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml11-transitional.dtd'>
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns="http://www.w3.org/TR/REC-html40">
:
:
<meta name='save' content='history' /> <---- don't forget
<style type='text/css'>
<!--
.saveHistory {
behavior:url(#default#savehistory);
}
.tocItemHide { display: none; }
.tocItemShow { display: block; }
-->
</style>
<script>
function fnFlash(oTitle){
var oList = F[oTitle.sourceIndex + 1];
if (oList.className == "tocItemHide"){
oList.className = "tocItemShow";
} else {
oList.className = "tocItemHide";
}
}
function fnSave(){
var sArray = "";
var oTrap;
for (var i=0; i<F.length; i++){
oTrap = F[i];
if ((oTrap.tagName == "OL") && (F[i-1].className == "tocHead")){
if (sArray.length == 0){
sArray = oTrap.className;
} else {
sArray += "|" + oTrap.className;
}
}
}
oPrimaryTOC.setAttribute("sPersistState", sArray);
}
function fnLoad(){
var sArray = oPrimaryTOC.getAttribute("sPersistState");
var cycle = 0;
var oArray;
var oTrap;
if ((!sArray) && (bTrapError)){
bError = true;
return false;
}
oArray = sArray.split("|");
for (var i=0; i<F.length; i++){
oTrap = F[i];
if ((oTrap.tagName == "OL") && (F[i-1].className == "tocHead")){
oTrap.className = oArray[cycle];
cycle ++;
}
}
}
</script>
:
:
<body>
<div>
<ol id="oPrimaryTOC" class="saveHistory" OnSave="fnSave();"
OnLoad="fnLoad();">
<li><div class="tocHead" onclick="fnFlash(this)">header 1</div></li>
<ol class="tocItemHide">
<li><a href='xxxx..xx.htm'>xxxxxx..xxxxx</a></li>
<li><a href='xxxxx..x.htm'>xxxxxx..xxxxx</a></li>
:
</ol>
<li><div class="tocHead" onclick="fnFlash(this)">header 2</div></li>
<ol class="tocItemHide">
<li><a href='xxxx..xx.htm'>xxxxxx..xxxxx</a></li>
<li><a href='xxxxx..x.htm'>xxxxxx..xxxxx</a></li>
:
</ol>
:
</div>
</body>
http://www.stupidarticles.com
http://www.halazona.com
http://www.shikapika.com
http://www.stakoza.com
http://www.uploadarticles.com
http://www.ganazat.com
http://www.damima.com
http://www.tarabiza.com
http://www.articlesxarticles.com
http://www.articlesfreedirectory.com