[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 /*********************************************** 2 * Contractible Headers script- © Dynamic Drive (www.dynamicdrive.com) 3 * This notice must stay intact for legal use. Last updated Oct 21st, 2003. 4 * Visit http://www.dynamicdrive.com/ for full source code 5 ***********************************************/ 6 7 var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off) 8 var collapseprevious="no" //Collapse previously open content when opening present? (yes/no) 9 10 if (document.getElementById){ 11 document.write('<style type="text/css">') 12 document.write('.expand{display:none;}') 13 document.write('</style>') 14 } 15 16 function getElementbyClass(classname){ 17 ccollect=new Array() 18 var inc=0 19 var alltags=document.all? document.all : document.getElementsByTagName("*") 20 for (i=0; i<alltags.length; i++){ 21 if (alltags[i].className==classname) 22 ccollect[inc++]=alltags[i] 23 } 24 } 25 26 function contractcontent(omit){ 27 var inc=0 28 while (ccollect[inc]){ 29 if (ccollect[inc].id!=omit) 30 ccollect[inc].style.display="none" 31 inc++ 32 } 33 } 34 35 function expandcontent(cid){ 36 if (typeof ccollect!="undefined"){ 37 if (collapseprevious=="yes") 38 contractcontent(cid) 39 document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none" 40 } 41 } 42 43 function revivecontent(){ 44 contractcontent("omitnothing") 45 selectedItem=getselectedItem() 46 selectedComponents=selectedItem.split("|") 47 for (i=0; i<selectedComponents.length-1; i++) 48 document.getElementById(selectedComponents[i]).style.display="block" 49 } 50 51 function get_cookie(Name) { 52 var search = Name + "=" 53 var returnvalue = ""; 54 if (document.cookie.length > 0) { 55 offset = document.cookie.indexOf(search) 56 if (offset != -1) { 57 offset += search.length 58 end = document.cookie.indexOf(";", offset); 59 if (end == -1) end = document.cookie.length; 60 returnvalue=unescape(document.cookie.substring(offset, end)) 61 } 62 } 63 return returnvalue; 64 } 65 66 function getselectedItem(){ 67 if (get_cookie(window.location.pathname) != ""){ 68 selectedItem=get_cookie(window.location.pathname) 69 return selectedItem 70 } 71 else 72 return "" 73 } 74 75 function saveswitchstate(){ 76 var inc=0, selectedItem="" 77 while (ccollect[inc]){ 78 if (ccollect[inc].style.display=="block") 79 selectedItem+=ccollect[inc].id+"|" 80 inc++ 81 } 82 83 document.cookie=window.location.pathname+"="+selectedItem 84 } 85 86 function do_onload(){ 87 getElementbyClass("expand") 88 if (enablepersist=="on" && typeof ccollect!="undefined") 89 revivecontent() 90 } 91 92 93 if (window.addEventListener) 94 window.addEventListener("load", do_onload, false) 95 else if (window.attachEvent) 96 window.attachEvent("onload", do_onload) 97 else if (document.getElementById) 98 window.onload=do_onload 99 100 if (enablepersist=="on" && document.getElementById) 101 window.onunload=saveswitchstate
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |