access key

C

Claudia Fong

I have this code below:

<asp:Button ID="Button1" runat="server" ACCESSKEY="A" Text="Change
Language" OnClick="Button1_Click" />

Is it possible to initially set the button invisible and when the user
click on ALT-A then the button will become visible?

Just trying to avoid user clicking on that button accidentaly

Cheers!

Claudi
 
G

Guest

Just trying to avoid user clicking on that button accidentaly

Simply add an alert on click:

<asp:button ... OnClientClick="return confirm('Are you sure?');"
 
M

Mark Rae [MVP]

<asp:Button ID="Button1" runat="server" ACCESSKEY="A" Text="Change
Language" OnClick="Button1_Click" />

Is it possible to initially set the button invisible and when the user
click on ALT-A then the button will become visible?

Yes it is but it's very messy, and totally non-standard web behaviour...

But, to answer your question, you'd need to wire up a client-side keypress
event with JavaScript:
http://www.google.co.uk/search?sour..._en-GBGB220GB220&q=JavaScript+body+onkeypress

Also, be aware that different browsers capture these events in different
ways, so you'll need to code around that if you require cross-browser
compatibility...
Just trying to avoid user clicking on that button accidentaly

<asp:Button ID="Button1" runat="server" Text="Change Language"
OnClick="Button1_Click" OnClientClick="return confirm('Are you sure you want
to change the language?');" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top