Skip to content

Instantly share code, notes, and snippets.

@tyoshikawa1106
Last active December 17, 2015 20:59
Show Gist options
  • Save tyoshikawa1106/5671152 to your computer and use it in GitHub Desktop.
Save tyoshikawa1106/5671152 to your computer and use it in GitHub Desktop.
Handling Keyboard Shortcuts in JavaScript http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php
<apex:page showHeader="true" sidebar="false">
<apex:includeScript value="{!$Resource.shortcut}" />
<apex:form >
<apex:outputText value="Ctrl+Shift+X Click!!" />
<br/>
<br/>
<apex:outputText value="Ctrl+Shift+Y Click!!" />
<br/>
<br/>
<apex:outputText value="Ctrl+Shift+Z Click!!" />
</apex:form>
<script>
shortcut.add("Ctrl+Shift+X",function() {
alert("Hi!! Ctrl+Shift+X Click!!");
});
shortcut.add("Ctrl+Shift+Y",function() {
alert("Hi!! Ctrl+Shift+Y Click!!");
});
shortcut.add("Ctrl+Shift+Z",function() {
alert("Hi!! Ctrl+Shift+Z Click!!");
});
</script>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment