Hi,
Webmills wrote:
Hi
I have a log out button at the top of my site. It is contained within a
web control within the master page.
Because it is the first button on the page, then by default it is the
one that is clicked whenever enter is pressed. This can be extremely
annoying to our users.
Is there any way of disabling this button to the enter press?
I understand that it is possible to set the default button within the
form tag. However this is contained within the master page, and I do
not want to have to set a default button programmatically on every
page.
Hope you can help.
James
JavaScript can help:
<input type="button"
onfocus="document.getElementById('anotherButton'). focus();" />
Note however that this will prevent the button to get any keyboard
action (like, when you tab through all the controls).
Another way is to use the body onload event to set the focus to another
control:
<body onload="document.getElementById('anotherButton').f ocus();">
This way, the button is only deselected when the page is loaded, but it
can anyway get focus through the keyboard.
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering:
http://www.galasoft-LB.ch
PhotoAlbum:
http://www.galasoft-LB.ch/pictures
Support children in Calcutta:
http://www.calcutta-espoir.ch