Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:33

Disabling Menu Option


Poster: nickol
Dated: Wednesday July 3 2002 - 19:17:19 BST

Can your menu support disabling a menu option? If not, can it be added. We'd the like the menu to stay the same, but some options may be disabled.


Poster: mrgreen
Dated: Friday July 5 2002 - 3:28:18 BST

I requested this feature be added a while back, but it hasn't been (yet). I managed to get the effect I want by co-opting a feature in a way not intended. You can see what I've done at http://mrgreen.image-power.com.

Here is my menu_array.js file. In particular look for the "disableURL" variable and how it is used. You will see that my menu uses Javascript to disable the link to the page currently displayed.

CIAO - mrgreen.

Code:
// Milonic DHTML Menu version 3.3.11
// please note that major changes to this file have been made.
//
// You no longer need to number your menus as in previous versions.
// The new menu structure allows you to name the menu instead. This means that you to remove menus and not break the system.
// The structure should also be much easier to modify, add & remove menus and menu items.
//
// If you are having difficulty with the menu please read the FAQ at http://www.milonic.co.uk/menu/faq.php before contacting us.
//
// Please note that the above text CAN be erased if you wish.



// The following line is critical for menu operation, and must appear only once.
menunum=0;menus=new Array();_d=document;function addmenu(){menunum++;menus[menunum]=menu;}function dumpmenus(){mt="<script language=javascript>";for(a=1;a<menus.length;a++){mt+=" menu"+a+"=menus["+a+"];"}mt+="<\/script>";_d.write(mt)}
//Please leave the above line intact

////////////////////////////////////
// Editable properties START here //
////////////////////////////////////

menubg = "ffebdc"

timegap=500            // The time delay for menus to remain visible
followspeed=5            // Follow Scrolling speed
followrate=40            // Follow Scrolling Rate
suboffset_top=10;         // Sub menu offset Top position
suboffset_left=10;         // Sub menu offset Left position

style1=[            // style1 is an array of properties. You can have as many property arrays as you need. This means that menus can have their own style.
"navy",               // Mouse Off Font Color
"ccccff",            // Mouse Off Background Color
"ffebdc",            // Mouse On Font Color
"4b0082",            // Mouse On Background Color
"ccccff",            // Menu Border Color
12,               // Font Size in pixels
"normal",            // Font Style (italic or normal)
"bold",               // Font Weight (bold or normal)
"Verdana, Arial",         // Font Name
4,               // Menu Item Padding
,               // Sub Menu Image (Leave this blank if not needed)
,               // 3D Border & Separator bar
"66ffff",            // 3D High Color
"000099",            // 3D Low Color
"Purple",            // Current Page Item Font Color (leave this blank to disable)
"pink",               // Current Page Item Background Color (leave this blank to disable)
"arrowdn.gif",            // Top Bar image (Leave this blank to disable)
"ffffff",            // Menu Header Font Color (Leave blank if headers are not needed)
"000099",            // Menu Header Background Color (Leave blank if headers are not needed)
]

//////////////////////////////////////////////////////////////////////////////////////////////////////////
disableURL = "# type=form;offfontcolor=9f9f9f;offbackcolor=ccccff;"

if ( "Resume for Martin R. Green" == document.title )
{
        resumeURL  = disableURL
        homeURL    = "javascript:loadRandomHomepage(\"../\")"
        aboutURL   = "../aboutme.html"
        quoteURL   = "../quotes.html"
        spamURL    = "../antispam.html"

        resumeStat = ""
        homeStat   = "Back to Martin Green\\'s home page"
        aboutStat  = "Martin Green\\'s &quot;About Me&quot; page"
        quoteStat  = "Martin Green\\'s Positive Quotations page"
        spamStat   = "Martin Green\\'s Anti-SPAM page"
}
else if ( "Martin Green's Home Page" == document.title )
{
        resumeURL  = "../resume/resume.html"
        homeURL    = disableURL
        aboutURL   = "../aboutme.html"
        quoteURL   = "../quotes.html"
        spamURL    = "../antispam.html"

        resumeStat = "Martin Green\\'s Resume page"
        homeStat   = ""
        aboutStat  = ( "Martin Green - About Me" == document.title ) ? "" : "Martin Green\\'s &quot;About Me&quot; page"
        quoteStat  = ( "Martin Green's Positive Quotation Page" == document.title ) ? "" : "Martin Green\\'s Positive Quotations page"
        spamStat   = ( "Martin Green's Anti-SPAM Page" == document.title ) ? "" : "Martin Green\\'s Anti-SPAM page"
}
else
{
        resumeURL  = "resume/resume.html"
        homeURL    = "javascript:loadRandomHomepage(\"./\")"
        aboutURL   = ( "Martin Green - About Me" == document.title ) ? disableURL : "aboutme.html"
        quoteURL   = ( "Martin Green's Positive Quotation Page" == document.title ) ? disableURL : "quotes.html"
        spamURL    = ( "Martin Green's Anti-SPAM Page" == document.title ) ? disableURL : "antispam.html"

        resumeStat = "Martin Green\\'s Resume page"
        homeStat   = ( "Martin Green's Home Page" == document.title ) ? "" : "Back to Martin Green\\'s home page"
        aboutStat  = ( "Martin Green - About Me" == document.title ) ? "" : "Martin Green\\'s &quot;About Me&quot; page"
        quoteStat  = ( "Martin Green's Positive Quotation Page" == document.title ) ? "" : "Martin Green\\'s Positive Quotations page"
        spamStat   = ( "Martin Green's Anti-SPAM Page" == document.title ) ? "" : "Martin Green\\'s Anti-SPAM page"
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////


addmenu(menu=[            // This is the array that contains your menu properties and details
"mainmenu",            // Menu Name - This is needed in order for the menu to be called
0,               // Menu Top - The Top position of the menu in pixels
0,               // Menu Left - The Left position of the menu in pixels
,               // Menu Width - Menus width in pixels
2,               // Menu Border Width
"",                                       // Screen Position - here you can use "center;left;right;middle;top;bottom" or a combination of "center:middle"
style1,                                 // Properties Array - this is set higher up, as above
1,               // Always Visible - allows the menu item to be visible at all time (1=on/0=off)
,               // Alignment - sets the menu elements text alignment, values valid here are: left, right or center
,               // Filter - Text variable for setting transitional effects on menu activation - see above for more info
,               // Follow Scrolling - Tells the menu item to follow the user down the screen (visible at all times) (1=on/0=off)
1,                // Horizontal Menu - Tells the menu to become horizontal instead of top to bottom style (1=on/0=off)
,               // Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on/0=off)
,               // Position of TOP sub image left:center:right
,               // ..Now Obsolete..
,               // Right To Left - Used in Hebrew for example. (1=on/0=off)
,               // Open the Menus OnClick - leave blank for OnMouseover (1=on/0=off)
,               // ID of the div you want to hide on MouseOver (useful for hiding form elements)
,               // Reserved for future use
,               // Reserved for future use
,               // Reserved for future use
,"Site&nbsp;Menu","# type=header;",,"",1 // "Description Text", "URL", "Alternate URL", "Status", "Separator Bar"
,"Home",homeURL,,homeStat,1
,"About&nbsp;Me",aboutURL,,aboutStat,1
,"Resume&nbsp;(C.V.)",resumeURL,,resumeStat,1
,"Quotations",quoteURL,,quoteStat,1
,"Anti-SPAM",spamURL,,spamStat,1
])

//////////////////////////////////
// Editable properties END here //
//////////////////////////////////
dumpmenus()


Poster: nickol
Dated: Thursday July 11 2002 - 14:55:31 BST

Thanks mrgreen. That works good.