home *** CD-ROM | disk | FTP | other *** search
/ Computer Buyer 1999 September / Dpcb0999.iso / Web / Homesite / data1.cab / HS_Wizards / DHTML / Outline_Main.wml next >
Text File  |  1999-04-12  |  3KB  |  125 lines

  1. <!-- *************** DHTML Outline (begin) ***************** -->
  2.  
  3. <STYLE TYPE='text/css'>
  4. <!--
  5. /*Define elements with children with the class='outlineParentItem', and all elements without children with class='outlineItem'*/
  6. li.oItem { color: $${PassiveColor}; cursor: text; } ;
  7. li.oParent { color: $${ActiveColor}; cursor: hand; } ;
  8. ul ul { display: none; } ;
  9. // -->
  10. </STYLE>
  11.  
  12. <SCRIPT LANGUAGE='Javascript'>
  13. <!--
  14.     // Returns the closest parent tag with tagName containing
  15.     // the src tag. If no such tag is found - null is returned.
  16.     function checkParent( src, tagName ) {
  17.         while ( src != null ) {
  18.             if (src.tagName == tagName) 
  19.                 return src;
  20.             src = src.parentElement;
  21.         }
  22.         return null;
  23.     }
  24.  
  25.     
  26.     // Returns the first tag with tagName contained by
  27.     // the src tag. If no such tag is found - null is returned.
  28.     function checkContent( src, tagName ) {
  29.         var pos = src.sourceIndex ;
  30.         while ( src.contains( document.all[++pos] ) )
  31.             if ( document.all[pos].tagName == tagName )
  32.                 return document.all[pos] ;
  33.         return null ;
  34.     }
  35.  
  36.       
  37.     // Handle onClick event in the outline box
  38.     function outlineAction() {     
  39.         var src = event.srcElement ;
  40.         var item = checkParent( src, "LI" ) ;
  41.  
  42.         if ( parent != null ) {
  43.             var content = checkContent( item, "UL" ) ;
  44.  
  45.             if ( content != null )
  46.                 if ( content.style.display == "" )
  47.                     content.style.display = "block" ;
  48.                 else
  49.                     content.style.display = "" ;
  50.         }
  51.         event.cancelBubble = true;
  52.     }
  53.     
  54. // -->
  55. </SCRIPT>
  56.  
  57.  
  58.  
  59. <DIV onClick="JavaScript: outlineAction();">
  60.     <UL>
  61. <WIZSET Items = OutlineItems>
  62. <WIZSET PrevItem = ''>
  63. <WIZSET PrevLevel = 0>
  64.  
  65. <WIZLOOP condition="1">
  66.  
  67.     <!---- get next item ---->
  68.     <WIZSET crlf = Find( Items, "\n" )>
  69.     <WIZIF crlf eq 0>
  70.         <WIZSET Item = Items>
  71.     <WIZELSE>
  72.         <WIZSET Item = Left( Items, crlf - 2 )>
  73.     </WIZIF>
  74.  
  75.     <WIZSET Level = 1>
  76.     <WIZLOOP condition="1">
  77.         <WIZSET ItemStart = Find( Item, "\t" )>
  78.         <WIZIF ItemStart eq 1>
  79.             <WIZSET Level = Level+1>
  80.             <WIZSET Item = Right( Item, Len(Item) - 1 )>
  81.         <WIZELSE>
  82.             <WIZBREAK>
  83.         </WIZIF>
  84.     </WIZLOOP>
  85.  
  86.  
  87. <WIZIF PrevLevel eq 0>
  88. <WIZELSEIF Level eq PrevLevel
  89.     >$${RepeatString("\t", PrevLevel)}<LI class='oItem'>$${PrevItem}</LI>
  90. <WIZELSEIF Level gt PrevLevel
  91.     >$${RepeatString("\t", PrevLevel)}<LI class='oParent'>$${PrevItem}
  92.     $${RepeatString("\t", PrevLevel)}<UL>
  93. <WIZELSE
  94.     >$${RepeatString("\t", PrevLevel)}<LI class='oItem'>$${PrevItem}</LI>
  95.     <WIZSET i = PrevLevel - 1>
  96.     <WIZLOOP condition="(i gte Level)"
  97.     >$${RepeatString("\t", i)}</UL>
  98.     $${RepeatString("\t",i - 1)}</LI>
  99. <WIZSET i = i - 1>
  100.     </WIZLOOP>
  101. </WIZIF>
  102.  
  103.     <WIZSET PrevItem = Item>
  104.     <WIZSET PrevLevel = Level>
  105.     <WIZIF crlf eq 0>
  106.         <WIZBREAK>
  107.     <WIZELSE>
  108.         <WIZSET Items = Right( Items, Len( Items ) - crlf )>
  109.     </WIZIF>
  110.  
  111. </WIZLOOP
  112.  
  113. >$${RepeatString("\t", PrevLevel)}<LI class='oItem'>$${PrevItem}</LI>
  114. <WIZSET i = PrevLevel - 1>
  115. <WIZLOOP condition="(i gte 1)">
  116. $${RepeatString("\t", i + 1)}</UL>
  117. $${RepeatString("\t",i)}</LI>
  118. <WIZSET i = i - 1>
  119. </WIZLOOP
  120. >    </UL>
  121. </DIV>
  122. <DIV></DIV>
  123.  
  124. <!-- *************** DHTML Outline (end) ***************** -->
  125.