Menu system for a simple button: keyboard handler

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
rstaveley
Beginner
Beginner
Posts: 1
Joined: Mon Aug 09, 2004 9:49 am

Menu system for a simple button: keyboard handler

Post by rstaveley »

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: Select all

// 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();
}
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: Select all

<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"?
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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
Post Reply