473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable Button Enter

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 programmaticall y on every
page.

Hope you can help.

James

Dec 7 '06 #1
1 3330
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 programmaticall y on every
page.

Hope you can help.

James
JavaScript can help:

<input type="button"
onfocus="docume nt.getElementBy Id('anotherButt on').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="documen t.getElementByI d('anotherButto n').focus();">

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
Dec 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
33306
by: http://links.i6networks.com | last post by:
I want to force the users to click submit to submit the forms. How do I disable "Enter Key" which will submit the form automatically when they entered the data in text field then pressed "enter key"
3
7347
by: sonu | last post by:
I want to disable the browser referesh and back button. is there any way in .net for above. Regards Amit
2
2728
by: cw | last post by:
Hi group, My page consist of few text boxes and a server side button control (asp:button), when i finished editing and press enter key, it will fire up the button click event. How to disable this event till i click or focus to the button? regards,
2
2950
by: nicholas | last post by:
How can I disable the enter key on an asp.net page? As the default button is the first on the page, and as the enter key clicks the default button, and as my first button on the page is th 'logou' button => when I have a search form for example and my users press ENTER instead of clicking on the button, they are logged out instead of transferred to the search results. So, I would like to disable the ENTER key...unless sombody has a...
1
2372
by: John Smith | last post by:
Hi, How can I disable enterkey in a form. I have using couple of asp textboxes, one asp button for search and two Image Buttons, one for Back and other for continue. But If I click on the text box and perss enter key it will always execute the back Image button and the page is redirecting to the previous page. I gave last tab order index for this button , it didn't work. I just want execute the search button if they click enter. How...
16
3461
by: Barry Gilmore | last post by:
Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!
1
2003
by: Daren Hawes | last post by:
Hi, I have a ASP.NET 1.1 page that in top corner has a login box & button. Then a large form. Users can fill out the form and press enter, but it actually submits the login not the one I want. How can I ensure that the Enter submits the second submit button on the page and not the first? How can I stop enter submitting at all?
8
9970
by: GS | last post by:
Hi, This is probably known solution but I have not found it in minimum amount of code. I'd like to disable button on client-side after clicking on it. Just disabling it in javascript do not produce postback event. Any examples in ASP.NET 2.0? Thanks,
8
5428
by: alamodgal | last post by:
hiiiiiiiiiii everybody, pls solve my problem if u can? Actualy what happens in my site when i press enter key it will show some secured information related to my site.So for that i have use this code to disable enter key: <script type="text/javascript" language="javascript"> /*-----script to disable F5 key begin-----*/ var version = navigator.appVersion; function...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.