473,730 Members | 4,313 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 3325
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
33300
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
7345
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
2724
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
2945
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
2370
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
3456
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
2001
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
9968
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
5427
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
8943
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
8770
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,...
0
9301
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9176
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
8184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6725
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4801
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3257
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
2713
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.