Quick question on Default button..

  • Thread starter Thread starter Rocky Moore
  • Start date Start date
Rocky,

TextBox.Attributes.Add("onkeydown", "javascript:if((event.which &&
event.which == 13) || (event.keyCode && event.keyCode ==
13)){document.Form1." & Button.ClientID & ".click();return false;}else
return true;")


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Rocky,

If you want a specific button clicked when the user could be anywhere on the
page combine the other script with this one:

<script language="JavaScript">
<!--
if (document.layers) document.captureEvents(Event.KEYPRESS); // needed if
you wish to cancel the key

document.onkeyup = keyhandler;

function keyhandler(e) {
if (document.layers)
Key = e.which;
else
Key = window.event.keyCode;
if (Key != 0)
alert("Key pressed! ASCII-value: " + Key);
}
//-->
</script>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
Thanks, that is real close to what I ended up with. Found the example MSDN
for a hot key. Made a tip of it as:

http://www.hintsandtips.com/ShowTip/106/hat.aspx

Just not sure how it will work if a person is in a text area control that
normally uses the ENTER Did not have the time to test.

Thanks again for your posts!

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!
 
Back
Top