Menu Javascript

Κώδικας, πληροφορίες, ερωτήσεις και απαντήσεις σχετικές με την JavaScript.

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
christos_t
Δημοσιεύσεις: 1
Εγγραφή: 15 Φεβ 2005 16:35
Τοποθεσία: Θεσσαλονικη

Menu Javascript

Δημοσίευση από christos_t » 15 Φεβ 2005 16:41

exo to parakato drop-down menu.
Ola douleuoun kala alla theloto eksis:
otan kaneis hover pano apo kapoio submenu na allazei to xroma tou original menu sto arxiko tou kai na min paramanei to idio (mpez).
Sigoura kapoios pou asxoleitai kai gnorizei ton codika tha mporei na me boithisei.
Euxaristo

Κώδικας: Επιλογή όλων

<!-- Javascript Code Menu Beginning --> 
  <script type="text/javascript" language="JavaScript">
<!---
// Use Freely as long as following disclaimer is intact &#58;&#58;
//---------------------------------------------------------------
// Cross Browser Multi-Orientation Menu v1.5 17th August 2004
// This script written by Rik Comery. www.ricom.co.uk
// For support, visit the "Resources" section at www.ricom.co.uk           
// All rights reserved.   
// Featured in the SimplytheBest DHTML Scripts Library at http&#58;//simplythebest.net/scripts/

//  MENU ITEMS //
// DUPLICATE THIS ENTIRE SECTION FOR MULTIPLE MENUS.  PLEASE SEE THE INSTRUCTIONS FILE FOR DETAILS ///   
var Menu1 = new Array &#40;&#41;
;var subMenu1 = new Array &#40;&#41;	

;   Menu1&#91;0&#93; = new Array&#40;"Αρχική Σελίδα", "http&#58;//www.christos.gr","_top", "center"&#41;
;     subMenu1&#91;0&#93; = new Array&#40;&#41;

;   Menu1&#91;1&#93; = new Array&#40;"wefwefwef", "/company.html","_top", "center"&#41;
;     subMenu1&#91;1&#93; = new Array&#40;&#41;
;     subMenu1&#91;1&#93;&#91;0&#93; = new Array &#40;"vvvvvvv", "/people.html","_top"&#41;
;     subMenu1&#91;1&#93;&#91;1&#93; = new Array &#40;"eeeeeee", "/chart.html","_top"&#41;
     
;   Menu1&#91;2&#93; = new Array&#40;"Δημόσια Έργα", "public.html","_top", "center"&#41;
;     subMenu1&#91;2&#93; = new Array&#40;&#41;
;	 subMenu1&#91;2&#93;&#91;0&#93; = new Array &#40;"aaaaaa", "/public_past.html","_top"&#41;
;     subMenu1&#91;2&#93;&#91;1&#93; = new Array &#40;"wwwwwwww", "/public_present.html","_top"&#41;	  
	 
;   Menu1&#91;3&#93; = new Array&#40;"wewedwed", "/private.html","_top", "center"&#41;
;     subMenu1&#91;3&#93; = new Array&#40;&#41;
;	 subMenu1&#91;3&#93;&#91;0&#93; = new Array &#40;"wefwefwef", "/private_past.html","_top"&#41;
;     subMenu1&#91;3&#93;&#91;1&#93; = new Array &#40;"wefwefwef", "/private_present.html","_top"&#41;	 
	 
;   Menu1&#91;4&#93; = new Array&#40;"wefwefwe", "/real.html","_top", "center"&#41;
;     subMenu1&#91;4&#93; = new Array&#40;&#41;
;     subMenu1&#91;4&#93;&#91;0&#93; = new Array &#40;"wefwefwe", "/real_past.html","_top"&#41;
;     subMenu1&#91;4&#93;&#91;1&#93; = new Array &#40;"wefwef", "/real_present.html","_top"&#41;
;	 subMenu1&#91;4&#93;&#91;2&#93; = new Array &#40;"wefwef", "/real_future.html","_top"&#41;   
	   
;   Menu1&#91;5&#93; = new Array&#40;"wefwefwef", "/management.html","_top", "center"&#41;
;     subMenu1&#91;5&#93; = new Array&#40;&#41;
;     subMenu1&#91;5&#93;&#91;0&#93; = new Array &#40;"wefwefwe", "/management_past.html","_top"&#41;
;     subMenu1&#91;5&#93;&#91;1&#93; = new Array &#40;"wefwefwe", "/management_present.html","_top"&#41;   
	 	 
;   Menu1&#91;6&#93; = new Array&#40;"efwefwef", "/contact.html","_top", "right"&#41;
;     subMenu1&#91;6&#93; = new Array&#40;&#41;

/// FORMAT MENU  ///
;menuStyle = "flat"                                  // Menu Style &#40;flat, 3d&#41;
;cellPadding = "3"                                   // Cell Padding
;cellBorder = 0                                      // Border width &#40;for no border, enter 0&#41;  THIS VALUE APPLIES TO ALL MENUS
;verticalOffset = "0"                                // Vertical offset of Sub Menu. 
;horizontalOffset = "0"                              // Horizontal offset of Sub Menu. 
;subMenuDelay = 0.2                                    // Time sub menu stays visible for &#40;in seconds&#41;. THIS VALUE APPLIES TO ALL MENUS
;subIndicate = 0                                     // Show if a sub menu is present &#40;use 0 for "no"&#41;  THIS VALUE APPLIES TO ALL MENUS
;indicator = "<img src='images/arrow-down.gif' border='0'>" // Symbol to show if a sub menu is present &#40;subIndicate must be to set to 1&#41;
                                                    // Use standard HTML <img> tag. You can use a character instead of an image. 
                                                    // e.g.      indicator = ">"
// Main Menu Items
;menuWidth = "109"                  // Width of menu item.  Use 0 for default
;borderColor = "Black"            // Border Colour &#40;flat mode only&#41;
;borderHighlight = "#97BBD3"      // Border Highlight Colour &#40;3d mode only&#41;
;borderShadow = "#31556D"         // Border Shadow Colour &#40;3d mode only&#41;
;menuBackground = "#800000"       // Cell Background Colour
;menuHoverBackground = "#FFEFAF"    // Cell Background Colour on mouse rollover
;fontFace = "arial"               // Font Face
;fontColour = "#FFFFFF"           // Font Colour
;fontHoverColour = "#000000"      // Font Colour on mouse rollover
;fontSize = "8pt"                 // Font Size
;fontDecoration = "none"          // Style of the link text &#40;none, underline, overline, line-through&#41;
;fontWeight = "normal"            // Font Weight &#40;normal, bold&#41;

// Sub Menu Items
;smenuWidth = "110"                 // Width of sub menu item.  Use 0 for default
;sborderColor = "Black"           // Border Colour &#40;flat mode only&#41;
;sborderHighlight = "#E9E9E2"     // Border Highlight Colour &#40;3d mode only&#41;
;sborderShadow = "#83837C"        // Border Shadow Colour &#40;3d mode only&#41;
;smenuBackground = "#800000"        // Cell Background Colour
;smenuHoverBackground = "#FFEFAF" // Cell Background Colour on mouse rolloverr
;sfontFace = "arial"              // Font Face
;sfontColour = "#FFFFFF"          // Font Colour
;sfontHoverColour = "#000000"     // Font Colour on mouse rollover
;sfontSize = "8pt"                // Font Size
;sfontDecoration = "none"         // Style of the link text &#40;none, underline, overline, line-through&#41;
;sfontWeight = "normal"           // Font Weight &#40;normal, bold&#41;

;quantity = 1
/// END FORMAT MENU  ////

/// DO NOT EDIT BELOW THIS LINE  ///
// Browser Sniffer
;var isIE = &#40;document.getElementById && document.all&#41;?true&#58;false;
var isNS4 = &#40;document.layers&#41;?true&#58;false;
var isNS6 = &#40;document.getElementById && !document.all&#41;?true&#58;false;
var timer;
var obj = &#40;isIE&#41;?"document.all"&#58;"document.getElementById"
// Menu Styles
;function createStyles&#40;quant&#41;&#123;
 styleBorder=&#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41; == "flat"&#41;?cellBorder&#58;0 
;  document.writeln &#40;'<style>'&#41;;
  document.writeln &#40;'.rcMenuStatic'+quant+' &#123;font-family&#58;'+fontFace.split&#40;","&#41;&#91;quant-1&#93;+';font-size&#58;'+fontSize.split&#40;","&#41;&#91;quant-1&#93;+';color&#58;'+fontColour.split&#40;","&#41;&#91;quant-1&#93;+';font-weight&#58;'+fontWeight.split&#40;","&#41;&#91;quant-1&#93;+';background-color&#58;'+menuBackground.split&#40;","&#41;&#91;quant-1&#93;+'; cursor&#58;hand; text-decoration&#58;'+fontDecoration.split&#40;","&#41;&#91;quant-1&#93;+'&#125;'&#41;;
  document.writeln &#40;'.rcMenuHover'+quant+'  &#123;font-family&#58;'+fontFace.split&#40;","&#41;&#91;quant-1&#93;+';font-size&#58;'+fontSize.split&#40;","&#41;&#91;quant-1&#93;+';color&#58;'+fontHoverColour.split&#40;","&#41;&#91;quant-1&#93;+';font-weight&#58;'+fontWeight.split&#40;","&#41;&#91;quant-1&#93;+';background-color&#58;'+menuHoverBackground.split&#40;","&#41;&#91;quant-1&#93;+'; cursor&#58;hand; text-decoration&#58;'+fontDecoration.split&#40;","&#41;&#91;quant-1&#93;+'&#125;'&#41;;
  document.writeln &#40;'.rcSubMenuStatic'+quant+' &#123;font-family&#58;'+sfontFace.split&#40;","&#41;&#91;quant-1&#93;+';font-size&#58;'+sfontSize.split&#40;","&#41;&#91;quant-1&#93;+';color&#58;'+sfontColour.split&#40;","&#41;&#91;quant-1&#93;+';font-weight&#58;'+sfontWeight.split&#40;","&#41;&#91;quant-1&#93;+';text-decoration&#58;'+sfontDecoration.split&#40;","&#41;&#91;quant-1&#93;+';background-color&#58;'+smenuBackground.split&#40;","&#41;&#91;quant-1&#93;+'; cursor&#58;hand&#125;'&#41;;
  document.writeln &#40;'.rcSubMenuHover'+quant+'  &#123;font-family&#58;'+sfontFace.split&#40;","&#41;&#91;quant-1&#93;+';font-size&#58;'+sfontSize.split&#40;","&#41;&#91;quant-1&#93;+';color&#58;'+sfontHoverColour.split&#40;","&#41;&#91;quant-1&#93;+';font-weight&#58;'+sfontWeight.split&#40;","&#41;&#91;quant-1&#93;+';text-decoration&#58;'+sfontDecoration.split&#40;","&#41;&#91;quant-1&#93;+';background-color&#58;'+smenuHoverBackground.split&#40;","&#41;&#91;quant-1&#93;+'; cursor&#58;hand&#125;'&#41;;
  document.writeln &#40;'</style>'&#41;;
&#125;
// Build and show the main menu items
function showMenus&#40;quant,definedOrientation&#41;
&#123;
  createStyles&#40;quant&#41;;
  if&#40;definedOrientation!=""&#41;&#123;orientation=definedOrientation;&#125;;
  if &#40;orientation.toLowerCase&#40;&#41; == "vertical"&#41;&#123;document.writeln &#40;'<table border="0" cellpadding="0" cellspacing="'+styleBorder+'" bgColor="'+borderColor.split&#40;","&#41;&#91;quant-1&#93;+'">'&#41;;&#125;
  else&#123;document.writeln &#40;'<table border="0" cellpadding="0" cellspacing="'+styleBorder+'" bgColor="'+borderColor.split&#40;","&#41;&#91;quant-1&#93;+'"><tr>'&#41;;&#125;  
  for &#40;x=0; x<eval&#40;"Menu"+quant&#41;.length; x++&#41;
  &#123;
    if &#40;orientation.toLowerCase&#40;&#41;=="vertical"&#41; document.writeln&#40;'<tr>'&#41;
;    document.writeln &#40;'<td width="'+menuWidth+'" onclick="tdMouseClick&#40;\''+quant+'mainLink'+x+'\'&#41;" onMouseOver="hoverMenu&#40;&#41;; popDown&#40;\''+quant+'\','+x+', \''+quant+'button'+x+'\',\''+orientation+'\'&#41;; " onMouseOut="clearMenu&#40;'+quant+','+x+'&#41;" '&#41;
;    if &#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41; == "3d"&#41;&#123;document.writeln &#40;'style="border-left&#58;'+cellBorder+'px solid '+borderHighlight.split&#40;","&#41;&#91;quant-1&#93;+';border-top&#58;'+cellBorder+'px solid '+borderHighlight.split&#40;","&#41;&#91;quant-1&#93;+';border-right&#58;'+cellBorder+'px solid '+borderShadow.split&#40;","&#41;&#91;quant-1&#93;+';border-bottom&#58;'+cellBorder+'px solid '+borderShadow.split&#40;","&#41;&#91;quant-1&#93;+';"'&#41;;&#125;        
    document.writeln &#40;'><div id="'+quant+'button'+x+'"><table border="0" cellpadding="'+cellPadding.split&#40;","&#41;&#91;quant-1&#93;+'" cellspacing="0" width="100%"><tr><td class="rcMenuStatic'+quant+'" id="'+quant+'cell'+x+'" nowrap>'&#41;;
    document.writeln &#40;'<a id="'+quant+'mainLink'+x+'" href="'+eval&#40;"Menu"+quant&#41;&#91;x&#93;&#91;1&#93;+'" target="'+eval&#40;"Menu"+quant&#41;&#91;x&#93;&#91;2&#93;+'" class="rcMenuStatic'+quant+'">'+eval&#40;"Menu"+quant&#41;&#91;x&#93;&#91;0&#93;+'</a></td>'&#41;;
    if &#40;subIndicate == 1&&eval&#40;"subMenu"+quant&#41;&#91;x&#93;.length>=1&#41;&#123;
      document.writeln&#40;'<td class="rcMenuStatic'+quant+'" id="'+quant+'cell'+x+'a" align="right">'&#41;;
      document.writeln &#40;'<a id="'+quant+'mainLink'+x+'a" href="'+eval&#40;"Menu"+quant&#41;&#91;x&#93;&#91;1&#93;+'" target="'+eval&#40;"Menu"+quant&#41;&#91;x&#93;&#91;2&#93;+'" class="rcMenuStatic'+quant+'">'+indicator+'</a></td>'&#41;;&#125;
    document.writeln &#40;'</tr></table></div></td>'&#41;;    
    if &#40;orientation.toLowerCase&#40;&#41;=="vertical"&#41; document.writeln&#40;'</tr>'&#41;
;  &#125;
  if &#40;orientation.toLowerCase&#40;&#41; == "vertical"&#41;&#123;document.writeln &#40;'</table>'&#41;;&#125;
  else&#123;document.writeln &#40;'</tr></table>'&#41;;&#125;   
// Build the sub menu items
  for &#40;x=0; x<eval&#40;"Menu"+quant&#41;.length; x++&#41;
  &#123; 
    if &#40;eval&#40;"subMenu"+quant&#41;&#91;x&#93;.length > 0&#41;
    &#123;     
      document.writeln &#40;'<div id="'+quant+'MENU'+x+'" style="visibility&#58;hidden; position&#58;absolute; z-index&#58;2" >'&#41;;
      document.writeln &#40;'<table width="'+smenuWidth.split&#40;","&#41;&#91;quant-1&#93;+'" border="0" cellpadding="'+cellPadding.split&#40;","&#41;&#91;quant-1&#93;+'" cellspacing="'+styleBorder+'" bgColor="'+sborderColor.split&#40;","&#41;&#91;quant-1&#93;+'">'&#41;;
      for &#40;y=0; y<eval&#40;"subMenu"+quant&#41;&#91;x&#93;.length; y++&#41;
      &#123;
        document.writeln &#40;'<tr>'&#41;;
        if &#40;eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;1&#93;.indexOf&#40;"#"&#41; != -1&#41;
        &#123;
          document.writeln &#40;'<td bgColor="'+eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;2&#93;+'" id="'+quant+'subMenu'+x+y+'" onMouseOver="hoverMenu&#40;&#41;; highlightMenu&#40;\'sub\','+x+','+y+',\'\','+quant+'&#41;" nowrap'&#41;
          ;if &#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41; == "3d"&#41;&#123;document.writeln &#40;'style="border-left&#58;'+cellBorder+'px solid '+sborderHighlight.split&#40;","&#41;&#91;quant-1&#93;+';border-top&#58;'+cellBorder+'px solid '+sborderHighlight.split&#40;","&#41;&#91;quant-1&#93;+';border-right&#58;'+cellBorder+'px solid '+sborderShadow.split&#40;","&#41;&#91;quant-1&#93;+';border-bottom&#58;'+cellBorder+'px solid '+sborderShadow.split&#40;","&#41;&#91;quant-1&#93;+';"'&#41;;&#125;
          document.writeln &#40;'><p style="font-family&#58;'+sfontFace.split&#40;","&#41;&#91;quant-1&#93;+'; font-size&#58;'+sfontSize.split&#40;","&#41;&#91;quant-1&#93;+'; color&#58;'+eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;1&#93;+'"id="'+quant+'subLink'+x+y+'">'+eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;0&#93;+'</p></td></tr>'&#41;;
        &#125;
        else
        &#123;
          document.writeln &#40;'<td id="'+quant+'subMenu'+x+y+'" class="rcSubMenuStatic'+quant+'" onMouseOver="hoverMenu&#40;&#41;; highlightMenu&#40;\'sub\','+x+','+y+',\'\','+quant+'&#41;" onMouseOut="clearMenu&#40;'+quant+','+x+'&#41;;" onclick="tdMouseClick&#40;\''+quant+'subLink'+x+y+'\'&#41;" nowrap'&#41;
          ;if &#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41; == "3d"&#41;&#123;document.writeln &#40;'style="border-left&#58;'+cellBorder+'px solid '+sborderHighlight.split&#40;","&#41;&#91;quant-1&#93;+';border-top&#58;'+cellBorder+'px solid '+sborderHighlight.split&#40;","&#41;&#91;quant-1&#93;+';border-right&#58;'+cellBorder+'px solid '+sborderShadow.split&#40;","&#41;&#91;quant-1&#93;+';border-bottom&#58;'+cellBorder+'px solid '+sborderShadow.split&#40;","&#41;&#91;quant-1&#93;+';"'&#41;;&#125;
          document.writeln &#40;'><a id="'+quant+'subLink'+x+y+'" href="'+eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;1&#93;+'" target="'+eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;2&#93;+'" class="rcSubMenuStatic'+quant+'">'+eval&#40;"subMenu"+quant&#41;&#91;x&#93;&#91;y&#93;&#91;0&#93;+'</a></td></tr>'&#41;;
        &#125;
      &#125;
      document.writeln &#40;'</table></div>'&#41;;
    &#125;
  &#125;
&#125; 
// Change colour or menu and submenu items when the mouse hovers over.  
function highlightMenu&#40;element,mainMenu,dropMenu,state,quant&#41;
&#123;
  hoverMenu&#40;&#41;;
  state=&#40;state == "hover"&#41;?"rcMenuHover"+quant&#58;"rcMenuStatic"+quant
 ; if &#40;element == "sub"&#41;
  &#123;
    for &#40;x=0; x < eval&#40;"subMenu"+quant&#41;&#91;mainMenu&#93;.length; x++&#41;
    &#123;
      if &#40;eval&#40;"subMenu"+quant&#41;&#91;mainMenu&#93;&#91;dropMenu&#93;&#91;1&#93;.indexOf&#40;"#"&#41; == -1&#41;&#123;
        eval&#40;obj+'&#40;"'+quant+'subMenu'+mainMenu+x+'"&#41;.className = "rcSubMenuStatic'+quant+'"'&#41;
        ;eval&#40;obj+'&#40;"'+quant+'subLink'+mainMenu+x+'"&#41;.className = "rcSubMenuStatic'+quant+'"'&#41;
     ; &#125;
    &#125; 
	
    if &#40;eval&#40;"subMenu"+quant&#41;&#91;mainMenu&#93;&#91;dropMenu&#93;&#91;1&#93;.indexOf&#40;"#"&#41; == -1&#41;  &#123;
      eval&#40;obj+'&#40;"'+quant+'subMenu'+mainMenu+dropMenu+'"&#41;.className="rcSubMenuHover'+quant+'"'&#41;
    ;  eval&#40;obj+'&#40;"'+quant+'subLink'+mainMenu+dropMenu+'"&#41;.className="rcSubMenuHover'+quant+'"'&#41;
 ;   &#125;
  &#125;
  else
  &#123;
    eval&#40;obj+'&#40;"'+quant+'cell'+mainMenu+'"&#41;.className = "'+state+'"'&#41;
;    eval&#40;obj+'&#40;"'+quant+'mainLink'+mainMenu+'"&#41;.className = "'+state+'"'&#41;
    ;if &#40;subIndicate == 1&&eval&#40;"subMenu"+quant&#41;&#91;mainMenu&#93;.length>=1&#41;
    &#123;
      eval&#40;obj+'&#40;"'+quant+'cell'+mainMenu+'a"&#41;.className = "'+state+'"'&#41;
     ; eval&#40;obj+'&#40;"'+quant+'mainLink'+mainMenu+'a"&#41;.className = "'+state+'"'&#41;
  ;  &#125;
  &#125;
&#125;
// Find positioning for sub menus
function getOffset&#40;obj, dim&#41; 
&#123;
  if&#40;dim=="left"&#41; 
  &#123;     
    oLeft = obj.offsetLeft;    
    while&#40;obj.offsetParent!=null&#41; 
    &#123;    
      oParent = obj.offsetParent     
   ;   oLeft += oParent.offsetLeft 
  ;    obj = oParent 	;
    &#125;
    return oLeft
  ;&#125;
  else if&#40;dim=="top"&#41;
  &#123;
    oTop = obj.offsetTop;
    while&#40;obj.offsetParent!=null&#41; 
    &#123;
      oParent = obj.offsetParent
     ; oTop += oParent.offsetTop
    ;  obj = oParent 	
 ;   &#125;
    return oTop
  ;&#125;
  else if&#40;dim=="width"&#41;
  &#123;
    oWidth = obj.offsetWidth
   ; return oWidth
;  &#125;  
  else if&#40;dim=="height"&#41;
  &#123;
    oHeight = obj.offsetHeight
 ;   return oHeight
  ;&#125;    
  else
  &#123;
    alert&#40;"Error&#58; invalid offset dimension '" + dim + "' in getOffset&#40;&#41;"&#41;
   ; return false;
  &#125;
&#125;
// Show sub menus
function popDown&#40;quant, param, id, orientation&#41;
&#123;
  var cellBorderOffset = &#40;isNS6&#41;?cellBorder&#58;eval&#40;cellBorder*2&#41;
;  var browserAdjustment = &#40;isNS6&#41;?cellBorder&#58;0;
  var menu;
  var button;

  if &#40;id&#41;
  &#123;    
    getOffset&#40;eval&#40;obj+'&#40;id&#41;'&#41;,'left'&#41;;
    getOffset&#40;eval&#40;obj+'&#40;id&#41;'&#41;,'top'&#41;;    
    getOffset&#40;eval&#40;obj+'&#40;id&#41;'&#41;,'width'&#41;;  
    getOffset&#40;eval&#40;obj+'&#40;id&#41;'&#41;,'height'&#41;;
    
    if &#40;eval&#40;"Menu"+quant+"&#91;"+param+"&#93;&#91;3&#93;"&#41;=="right" && eval&#40;"subMenu"+quant+"&#91;"+param+"&#93;.length"&#41;>0&#41; 
    &#123; 
      oLeft=oLeft  
  ;    oLeft=oLeft+oWidth; 
      getOffset&#40;eval&#40;obj+'&#40;"'+quant+'MENU'+param+'"&#41;'&#41;,'width'&#41;;
      oLeft=oLeft-oWidth ;
      alignAdjustment = cellBorder*2 + 1;
    &#125;
    else 
    &#123;
      alignAdjustment = 0
;      oLeft=oLeft
    ;&#125;    
  &#125;  

  
  n = 0;    
  while &#40;n < eval&#40;"Menu"+quant&#41;.length&#41;
  &#123;          
    menu = quant+"MENU"+n
   ; if &#40;param == n&#41;
    &#123;
      theObj = eval&#40;obj+'&#40;menu&#41;'&#41;;
      if &#40;theObj&#41;
      &#123;
         theObj.style.visibility = "visible"
        ;  if &#40;orientation.toLowerCase&#40;&#41;=="vertical"&#41;&#123;
            theObj.style.left=&#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41;=="flat"&#41;?oLeft+oWidth+cellBorder+parseInt&#40;horizontalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;&#58;oLeft+oWidth+cellBorderOffset+parseInt&#40;horizontalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;;
            theObj.style.top=&#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41;=="flat"&#41;?oTop-cellBorder+parseInt&#40;verticalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;&#58;oTop+parseInt&#40;verticalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;-browserAdjustment;&#125;
          else&#123;
            theObj.style.left=&#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41;=="flat"&#41;?oLeft-cellBorder+parseInt&#40;horizontalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;+alignAdjustment&#58;oLeft+parseInt&#40;horizontalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;-browserAdjustment+alignAdjustment;
            theObj.style.top=&#40;menuStyle.split&#40;","&#41;&#91;quant-1&#93;.toLowerCase&#40;&#41;=="flat"&#41;?oTop+oHeight+cellBorder+parseInt&#40;verticalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;&#58;oTop+oHeight+cellBorderOffset+parseInt&#40;verticalOffset.split&#40;","&#41;&#91;quant-1&#93;&#41;;&#125;
        &#125;
      
       highlightMenu&#40;'main',n,'','hover',quant&#41;
      ; if &#40;eval&#40;"subMenu"+quant&#41;&#91;param&#93;.length > 0&#41;
       &#123;
         for &#40;x=0; x<eval&#40;"subMenu"+quant&#41;&#91;param&#93;.length; x++&#41;
         &#123;
           if&#40;eval&#40;"subMenu"+quant&#41;&#91;param&#93;&#91;x&#93;&#91;1&#93;.indexOf&#40;"#"&#41; == -1&#41;&#123;
             eval &#40;obj+'&#40;"'+quant+'subMenu'+param+x+'"&#41;.className = "rcSubMenuStatic'+quant+'"'&#41;
           ;  eval &#40;obj+'&#40;"'+quant+'subLink'+param+x+'"&#41;.className = "rcSubMenuStatic'+quant+'"'&#41;  
        ;   &#125;       
         &#125;
       &#125;
    &#125;
    else 
    &#123;  
      for &#40;x=1; x<quantity+1; x++&#41;
      &#123;       
        menu = x+"MENU"+n   
        //alert&#40;menu&#41;     
    ;    if &#40;eval&#40;obj+'&#40;menu&#41;'&#41;&#41;
        &#123;
          eval&#40;obj+'&#40;menu&#41;.style.visibility = "hidden"'&#41;            
   ;     &#125;
        highlightMenu &#40;'main',n,'','static',quant&#41;
;      &#125;
    &#125;

   ; n++
  ;&#125;  
&#125;
// Re-set timer for sub menus
function hoverMenu&#40;&#41;
&#123;
  if&#40;timer&#41;
  clearTimeout&#40;timer&#41;;
&#125;
// Set timer for sub menus
function clearMenu&#40;quant,menu&#41;
&#123;
  setDelay = subMenuDelay*1000
;  delay = &#40;eval&#40;"subMenu"+quant&#41;&#91;menu&#93;.length > 0&#41;?setDelay&#58;1

  ;
  timer = setTimeout&#40;"popDown&#40;"+quant+","+&#40;eval&#40;"Menu"+quant&#41;.length + 1&#41;+"&#41;",delay&#41;
;&#125;
// when you click the box, perform the same function as if the user had clicked the hyperlink
function tdMouseClick&#40;theElement&#41;
&#123;
  eval&#40;obj+'&#40;theElement&#41;.click&#40;&#41;'&#41;;
&#125;
//-->
</script>

<!-- Javascript Code Menu Ending -->



<!-- Javascript Menu -->
<center>
<script type="text/javascript" language="JavaScript">showMenus&#40;1,'Horizontal'&#41;;</script>
</center>		  
<!-- Javascript Menu -->

Άβαταρ μέλους
skeftomilos
Script Master
Δημοσιεύσεις: 2888
Εγγραφή: 07 Ιαν 2005 07:22
Τοποθεσία: Αθήνα

Menu Javascript

Δημοσίευση από skeftomilos » 16 Φεβ 2005 10:48

Έλεοοος!!! :doh: :yea::force: :cop:
Γειά σου newbie, σου απαντά ένας newbie.
Καλά, έστι μπαίνουν πρώτη φορά σε ένα σπίτι?
Καλημέρα μαντάμ, έχω σαράντα τόνους κώδικα να ξεφορτώσω. Κάντε χώρο στο σαλόνι
μέχρι να κωλώσω τη νταλίκα και βάλτε και κανά χεράκι γιατί έχουμε και δουλειές.
:)
Είδα λίγο το script αλλά για να βγάλω άκρη θα ήθερα κανά οχτάωρο γεμάτο. Δεν υπάρχει όμως
λόγος μιάς και δεν πρόκειται για menu καλής ποιότητας. Εκτός από το πρόβλημα που αναφέρεις,
παρατήρησε ότι τα link δεν επεκτείνονται σε όλη την έκταση των κελιών αλλά μόνο πάνω από τα
γράμματα. Απ' ό,τι είδα γίνεται χρήση <tables> και JavaScript, χωρίς να γίνεται εκμετάλευση
των δυνατοτήτων που προσφέρουν τα CSS και συγκεκριμένα του style a:hover. Αυτό κάνει τον
κώδικα ογκώδη άνευ λόγου, παρά τις προσπάθειες του programmer να μειώσει το μέγεθός του με
διάφορα κόλπα. 18K είναι μεγάλο μέγεθος για ένα menu, αν σκεφτείς ότι το όριο για μια σελίδα είναι
60K σύμφωνα με τους ειδικούς της usability (συνολικά HTML, CSS, JS, εικόνες). Επιπλέον, με τα
τόσα κόλπα ο κώδικας είναι σχεδόν ακατανόητος, καθώς απουσιάζει και κάθε comment σχετικό με
την προγραμματιστική λογική, κάτι απαραίτητο για την κατανόηση και βελτίωσή του από άλλους
προγραμματιστές.

Δεν έχω κάποιο καλύτερο menu να σου προτείνω, πάντως άν βρεις κανένα ενημέρωσέ με αν
θέλεις γιατί με ενδιαφέρει και μένα το θέμα.
The pure and simple truth is rarely pure and never simple. Ο μη νους δε σκέπτεται μη σκέψεις για το τίποτα.

Άβαταρ μέλους
greekbytes
WebDev Moderator
Δημοσιεύσεις: 2438
Εγγραφή: 15 Νοέμ 2002 15:42
Τοποθεσία: Αθήνα
Επικοινωνία:

Menu Javascript

Δημοσίευση από greekbytes » 16 Φεβ 2005 12:34

ρίξε μία ματιά εδώ: http://www.alistapart.com/articles/horizdropdowns/
http://www.alistapart.com/articles/dropdowns
για το πως να φτιάξεις κάτι πιο εύχρηστο και μικρό σε μέγεθος με css

Άβαταρ μέλους
fafos
Script Master
Δημοσιεύσεις: 6231
Εγγραφή: 30 Νοέμ 2004 03:09

Menu Javascript

Δημοσίευση από fafos » 16 Φεβ 2005 12:35

Ola alazoun edo:

Κώδικας: Επιλογή όλων

// Main Menu Items 
;menuWidth = "109"                  // Width of menu item.  Use 0 for default 
;borderColor = "Black"            // Border Colour &#40;flat mode only&#41; 
;borderHighlight = "#97BBD3"      // Border Highlight Colour &#40;3d mode only&#41; 
;borderShadow = "#31556D"         // Border Shadow Colour &#40;3d mode only&#41; 
;menuBackground = "#800000"       // Cell Background Colour 
;menuHoverBackground = "#FFEFAF"    // Cell Background Colour on mouse rollover 
;fontFace = "arial"               // Font Face 
;fontColour = "#FFFFFF"           // Font Colour 
;fontHoverColour = "#000000"      // Font Colour on mouse rollover 
;fontSize = "8pt"                 // Font Size 
;fontDecoration = "none"          // Style of the link text &#40;none, underline, overline, line-through&#41; 
;fontWeight = "normal"            // Font Weight &#40;normal, bold&#41; 

// Sub Menu Items 
;smenuWidth = "110"                 // Width of sub menu item.  Use 0 for default 
;sborderColor = "Black"           // Border Colour &#40;flat mode only&#41; 
;sborderHighlight = "#E9E9E2"     // Border Highlight Colour &#40;3d mode only&#41; 
;sborderShadow = "#83837C"        // Border Shadow Colour &#40;3d mode only&#41; 
;smenuBackground = "#800000"        // Cell Background Colour 
;smenuHoverBackground = "#FFEFAF" // Cell Background Colour on mouse rolloverr 
;sfontFace = "arial"              // Font Face 
;sfontColour = "#FFFFFF"          // Font Colour 
;sfontHoverColour = "#000000"     // Font Colour on mouse rollover 
;sfontSize = "8pt"                // Font Size 
;sfontDecoration = "none"         // Style of the link text &#40;none, underline, overline, line-through&#41; 
;sfontWeight = "normal"           // Font Weight &#40;normal, bold&#41; 

kai an katalava kala prepei na allakseis to xroma se auto:

menuHoverBackground = "#FFEFAF" // Cell Background Colour on mouse rollover

skeftomile mallon den exeis dei ti arxeia paragoun epaggelmatika ergaleia gia paromoia menous. to parapano to prospathisa sto AllwebMenus kai mou to evgale 250kb!! :o

Άβαταρ μέλους
Cha0s
SysAdmin
Δημοσιεύσεις: 10242
Εγγραφή: 28 Ιούλ 2001 03:00

Menu Javascript

Δημοσίευση από Cha0s » 16 Φεβ 2005 12:46

fafos έγραψε:skeftomile mallon den exeis dei ti arxeia paragoun epaggelmatika ergaleia gia paromoia menous. to parapano to prospathisa sto AllwebMenus kai mou to evgale 250kb!! :o
Ε τότε δεν είναι επαγγελματικά εργαλία αλλά εργαλία αρπαχτής :kaloe:

Το είδα και εγώ σήμερα το συγκεκριμένο utility που λες γιατί ψάχνω κάτι ανάλογο...

Απάντηση

Επιστροφή στο “JavaScript και Frameworks”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες