Letters as Shortcut for Buttons
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Letters as Shortcut for Buttons
I guess that depends on what 'event' is in your example...
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Letters as Shortcut for Buttons
Actually, looking at my earlier example, it was not good because that event is calling an anonymous function, which would be difficult to unregister since it wasn't saved anywhere.
You'd have to do this in the onload event:
And this in the onsubmit:
You'd have to do this in the onload event:
Code: Select all
window.ericsLovelyKeydownRoutine = function(event) {
event = event || window.event;
var key = event.which || event.keyCode;
if(key == 89) {
// 'Y' key pressed
pui.click("btnYes");
}
if(key == 78) {
// 'N' key pressed
pui.click("btnNo");
}
}
addEvent(document, "keydown", window.ericsLovelyKeydownRoutine);
Code: Select all
removeEvent(document, "keydown", window.ericsLovelyKeydownRoutine);
-
- Experienced User
- Posts: 116
- Joined: Wed Sep 05, 2012 11:14 am
- First Name: Eric
- Last Name: Hill
- Company Name: Integrated Corporate Solutions
- Phone: 256-760-8239
- Address 1: 501 S Wood Avenue
- City: Florence
- State / Province: Alabama
- Zip / Postal Code: 35630
- Country: United States
- Contact:
Re: Letters as Shortcut for Buttons
Ha!! Thanks Scott! Imma gonna use that exact naming convention!!!!!!!
Who is online
Users browsing this forum: No registered users and 3 guests