iAlex
Junior Member
Posts: 73
|
Post by iAlex on Dec 20, 2007 5:18:28 GMT -5
This code will allow each user to expand/collapse the news fader. It will also remember your choice.
Cross Browser.
Main Footer.
Open Source.
<script type="text/javascript"> <!--
/*Expand/Collapse News Fader - By iAlex - Open Source*/
if(location.href.match(/action=home/) || !location.href.match(/action/) && !document.postForm && !document.modifyForm){ var iTd=document.getElementsByTagName('td'); var i=iTd.length; while(--i){ if(iTd.item(i).className=="newstitlebg" && iTd.item(i).align=="center" && iTd.item(i).innerHTML.match(/>News</)){ var iNewSpan=document.createElement('span'); iNewSpan.innerHTML='<font color="'+iTd.item(i).firstChild.color+'"><b> - <font size="1">(Expand/Collapse)</font></b></font>'; iNewSpan.style.cursor='pointer'; iNewSpan.onclick=function(){iNewsCollapse(this);}; iTd.item(i).appendChild(iNewSpan); (document.cookie.match(/iNews=iCollapsed/))? iNewsCollapse(iNewSpan) : ''; break; } } } function iNewsCollapse(iSpan){ var iTr=iSpan.parentNode.parentNode.nextSibling; (iTr.style.display=="none")? document.cookie='iNews=iCollapsed;expires=Sat, 20 Jan 1990 12:12:12 UTC; path=/;' : document.cookie='iNews=iCollapsed;expires=Sat, 20 Jan 2050 12:12:12 UTC; path=/;'; (iTr.style.display=="none")? iTr.style.display='' : iTr.style.display='none'; }
//--> </script>
|
|