Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:16
Menu system for a simple button: keyboard handler
Poster: rstaveley
Dated: Monday August 9 2004 - 10:13:59 BST
I'm trying to create a cohesive look and feel for my site, and I like my Milonic menu... so much so that I want to carry its look and feel throughout the site wherever I have buttons.
I have the following JavaScript in a common header:
Code:
// Menu-type button - a sledgehammer to crack a nut
// perhaps, but this gives the button the same look and
// feel as the menu system
function menu_button(menu_name,button_text,button_url,status_text)
{
with(milonic=new menuname(menu_name)){
style=menuStyle;
top=155;
left=200;
alwaysvisible=1;
orientation="horizontal";
overfilter="";
position="relative";
aI("text="+button_text+";url="+button_url+";status="+status_text);
}
drawMenus();
}
// perhaps, but this gives the button the same look and
// feel as the menu system
function menu_button(menu_name,button_text,button_url,status_text)
{
with(milonic=new menuname(menu_name)){
style=menuStyle;
top=155;
left=200;
alwaysvisible=1;
orientation="horizontal";
overfilter="";
position="relative";
aI("text="+button_text+";url="+button_url+";status="+status_text);
}
drawMenus();
}
Wherever I want to position a button, I embed a bit of script to call my menu_button function.
e.g. For a login form:
Code:
<td>
<script>menu_button("Login","Submit","JavaScript:login.submit()","Submit details");</script>
</td>
<script>menu_button("Login","Submit","JavaScript:login.submit()","Submit details");</script>
</td>
I'd like to get the button to support keypresses so that the user can tab over to it and press the spacebar to achieve the same results as clicking the button.
I notice that there was some support about getting keyboard support into the menu system back in 2002. Did this come to fruition? If not, is there something else I can do to handle a keyboard even specifically on my "menu_button"?
Poster: kevin3442
Dated: Wednesday August 11 2004 - 4:30:13 BST
I don't know the status of keyboard input for the menu. I seem to recall tha Maz once reported that top-level menu items that include a standard url (a link as opposed to a js call) can be tabbed to.
I suppose you could also write your own keypress event handler and when the correct key was pressed you could pop a submenu at the button's location or call the same js that your "menu button" calls when clicked.
Cheers,
Kevin