Original Script: Smart Folding Menu Tree Script
I am trying to convert this script from using unordered lists to ordered lists. At first it looks simple, but the appearance I would like it to have is not.
With the ordered list, I would like just the list item to be changed, not the numeral proceeding it. So, with the default page color=#003, that is the color the numerals should be. One way that I came up with to get around that was to have the items with drop-down lists to have <span>s that changed color. The problem is that I don't know how to get the <span> to change color when it is selected.
The two colors I am using are:
unselected (folded):#390::selected (unfolded):#609
Here is the code so far:
CSS codeJavaScript Code:Code:<style> <!-- #foldheader{cursor:pointer;cursor:hand;} #foldheader span {color:#390;} #foldinglist{cursor:auto;font-weight:400;color:#003;} //--> </style>Sample HTML code:Code:<script language="JavaScript1.2"> <!-- //Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02) //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use var head="display:''" var ns6=document.getElementById&&!document.all var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1 function checkcontained(e){ var iscontained=0 cur=ns6? e.target : event.srcElement i=0 if (cur.id=="foldheader") iscontained=1 else while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){ if (cur.id=="foldheader"||cur.id=="foldinglist"){ iscontained=(cur.id=="foldheader")? 1 : 0 break } cur=ns6? cur.parentNode : cur.parentElement } if (iscontained){ var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("OL")[0] if (foldercontent.style.display=="none"){ foldercontent.style.display="" } else{ foldercontent.style.display="none" } } } if (ie4||ns6) document.onclick=checkcontained //--> </script>Is this doable or easier to do some other way? Also, there may be submenues.HTML Code:<ol> <li id="foldheader"><span>Heading 1</span></li> <ol id="foldinglist" style="display:none;" style="&{head};"> <li>Sub-heading 1a</li> <li>Sub-heading 1b</li> <li>Sub-heading 1c</li> <li>Sub-heading 1d</li> <li>Sub-heading 1e</li> </ol>
Another question, how many of those carriage returns can be safely removed?



Reply With Quote

Bookmarks